Part Number Hot Search : 
37220 J115F11A MT8926AE 10ESK1 SC522 CDSV2 CF401 SS14MDP2
Product Description
Full Text Search
 

To Download MC912DG128A Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  mc68hc912dt128a/d mc68hc912dt128a mc68hc912dg128a technical data rev 2.0 june 12, 2001

mc68hc912dt128a rev 2.0 motorola revision history 3 revision history revision history this section lists the revision history of the document since the first release. data for previous internal drafts is unavailable. changes from rev 1.0 to rev 2.0 section page (in rev 2.0) description of change pinout and signal descriptions 28 , 29 figures 4 and 5, pin 97 changed to test and note added. 31 text added about connection of power supplies. 33 note about non-standard oscillator circuit expanded. 33 dc bias capacitor added to figure 8 and notes added to cover dc bias. 39 , 45 text added in table 6 and port can pin descriptions about non-connection of txcan pins when mscan modules are not used. registers 53 , 58 cd bit name corrected in atd0ctl5 and atd1ctl5. eeprom 102 new section added ? eeprom selective write more zeros ? clock functions 141 to 158 major rewrite of limp-home and fast stop recovery modes . 159 system clock frequency formulae updated for clarification. 160 figure 18 modified for clarification. 163 figure 21 modified for clarification. enhanced capture timer 192 figure 28 modified for clarification. analog-to-digital converter 321 shading removed from cc bit in table 54 . 320 , 321 cd bit name corrected.
revision history mc68hc912dt128a rev 2.0 4 revision history motorola changes from first version (internal release, no revision number) to rev 1.0 electrical characteristics 351 , 352 preliminary notes removed. 359 eeprom programming maximum time to ? auto ? bit set and eeprom erasing maximum time to ? auto ? bit set added to table 73 . 367 several values in table 78 updated. 359 changed note after table 73 and table 74 to read ? based on the average life time operating temperature of 70 c. ? appendix a: mc68hc912dt128a 375 new section added ? 2d. eeprom selective write more zeros ? . new section added ? 6. port adx ? . new section added ? 7. atd ? . appendix b: cgm practical aspects 378 new section added ? dc bias ? . section page (in rev 1.0) description of change general description 21 ordering information updated. eeprom 109 addition of caution regarding attempts to erase or program protected locations. msi 236 clarification of sp0dr register state on reset. section page (in rev 2.0) description of change
mc68hc912dt128a rev 2.0 motorola list of sections 5 list of sections list of sections revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 list of sections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 table of contents. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 general description . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 central processing unit . . . . . . . . . . . . . . . . . . . . . . . . . . 21 pinout and signal descriptions. . . . . . . . . . . . . . . . . . . . 27 registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 operating modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 resource mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 bus control and input/output . . . . . . . . . . . . . . . . . . . . 83 flash eeprom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 eeprom. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 resets and interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 i/o ports with key wake-up . . . . . . . . . . . . . . . . . . . . . 127 clock functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 ? motorola, inc., 2000
list of sections mc68hc912dt128a rev 2.0 6 list of sections motorola pulse-width modulator . . . . . . . . . . . . . . . . . . . . . . . . . 171 enhanced capture timer . . . . . . . . . . . . . . . . . . . . . . . 187 multiple serial interface . . . . . . . . . . . . . . . . . . . . . . . . 223 inter-ic bus. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247 mscan controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269 analog-to-digital converter (atd) . . . . . . . . . . . . . . . 311 development support . . . . . . . . . . . . . . . . . . . . . . . . . . 327 electrical characteristics . . . . . . . . . . . . . . . . . . . . . . . 351 appendix a: mc68hc912dt128a . . . . . . . . . . . . . . . . 373 appendix b: cgm practical aspects . . . . . . . . . . . . . 377 glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389 literature updates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401
mc68hc912dt128a rev 2.0 motorola table of contents 7 table of contents table of contents revision history changes from rev 1.0 to rev 2.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . .3 changes from first version to rev 1.0 . . . . . . . . . . . . . . . . . . . . . . . . . 4 list of sections table of contents general description contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 mc68hc912dt128a block diagram . . . . . . . . . . . . . . . . . . . . . . . . . 17 mc68hc912dg128a block diagram . . . . . . . . . . . . . . . . . . . . . . . . . 18 ordering information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 central processing unit contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 programming model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 data types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 addressing modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 indexed addressing modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 opcodes and operands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 pinout and signal descriptions contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 mc68hc912dt128a pin assignments in 112-pin qfp . . . . . . . . . . . 27 power supply pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 signal descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 port signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 registers contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 register block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
table of contents mc68hc912dt128a rev 2.0 8 table of contents motorola operating modes contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .63 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .63 operating modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .63 background debug mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .68 resource mapping contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .69 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .69 internal resource mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .69 flash eeprom mapping through internal memory expansion . . . . .72 miscellaneous system control register . . . . . . . . . . . . . . . . . . . . . . .77 mapping test registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .79 memory maps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .80 bus control and input/output contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .83 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .83 detecting access type from external signals . . . . . . . . . . . . . . . . . .83 registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .84 flash eeprom contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .93 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .93 overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .93 flash eeprom control block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .94 flash eeprom arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .94 flash eeprom registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .95 operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .97 programming the flash eeprom . . . . . . . . . . . . . . . . . . . . . . . . . . .97 erasing the flash eeprom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .98 stop or wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .99 eeprom contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .101 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .101 eeprom selective write more zeros . . . . . . . . . . . . . . . . . . . . . . .102 eeprom programmer ? s model . . . . . . . . . . . . . . . . . . . . . . . . . . . .103 eeprom control registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .105 program/erase operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .111 shadow word mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .111 programming eedivh and eedivl registers . . . . . . . . . . . . . . . . .112
table of contents mc68hc912dt128a rev 2.0 motorola table of contents 9 resets and interrupts contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 exception priority . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 maskable interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 latching of interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 interrupt control and priority registers . . . . . . . . . . . . . . . . . . . . . . 119 interrupt test registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 resets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 effects of reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 register stacking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124 i/o ports with key wake-up contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 key wake-up and port registers . . . . . . . . . . . . . . . . . . . . . . . . . . 128 key wake-up input filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 clock functions contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 clock sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136 phase-locked loop (pll) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 acquisition and tracking modes . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 limp-home and fast stop recovery modes . . . . . . . . . . . . . . . . 141 system clock frequency formulae . . . . . . . . . . . . . . . . . . . . . . . . 159 clock divider chains . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160 computer operating properly (cop) . . . . . . . . . . . . . . . . . . . . . . . 163 real-time interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164 clock monitor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164 clock function registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 pulse-width modulator contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171 pwm register descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 pwm boundary cases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
table of contents mc68hc912dt128a rev 2.0 10 table of contents motorola enhanced capture timer contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .187 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .187 enhanced capture timer modes of operation . . . . . . . . . . . . . . . . .194 timer register descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .197 timer and modulus counter operation in different modes . . . . . . .221 multiple serial interface contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .223 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .223 block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .224 serial communication interface (sci) . . . . . . . . . . . . . . . . . . . . . . .224 serial peripheral interface (spi) . . . . . . . . . . . . . . . . . . . . . . . . . . . .235 port s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .245 inter-ic bus contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .247 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .247 iic features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .248 iic system configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .250 iic protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .250 iic register descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .254 iic programming examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .263 mscan controller contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .269 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .269 external pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .270 message storage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .271 identifier acceptance filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .276 interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .279 protocol violation protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .281 low power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .282 timer link . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .285 clock system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .286 memory map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .288 programmer ? s model of message storage . . . . . . . . . . . . . . . . . . . .289 programmer ? s model of control registers . . . . . . . . . . . . . . . . . . . .294
table of contents mc68hc912dt128a rev 2.0 motorola table of contents 11 analog-to-digital converter (atd) contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312 atd registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313 atd mode operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325 development support contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327 instruction queue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327 background debug mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329 breakpoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343 instruction tagging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350 electrical characteristics contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352 tables of data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353 appendix a: mc68hc912dt128 a contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373 significant changes from the mc68hc912dg128 (non-a suffix device) 373 appendix b: cgm practical aspects contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377 a few hints for the cgm crystal oscillator application . . . . . . . . 377 practical aspects for the pll usage . . . . . . . . . . . . . . . . . . . . . . 380 printed circuit board guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . 385 glossary literature updates literature distribution centers . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401 customer focus center . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 402 microcontroller division ? s web site . . . . . . . . . . . . . . . . . . . . . . . . . 402
table of contents mc68hc912dt128a rev 2.0 12 table of contents motorola
mc68hc912dt128a rev 2.0 motorola general description 13 general description general description contents introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 mc68hc912dt128a block diagram . . . . . . . . . . . . . . . . . . . . . . . . . 17 ordering information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 introduction the mc68hc912dt128a microcontroller unit (mcu) is a 16-bit device composed of standard on-chip peripherals including a 16-bit central processing unit (cpu12), 128k bytes of flash eeprom, 8k bytes of ram, 2k bytes of eeprom, two asynchronous serial communications interfaces (sci), a serial peripheral interface (spi), an inter-ic interface (i 2 c), an enhanced capture timer (ect), two 8-channel, 10-bit analog-to-digital converters (adc), a four-channel pulse-width modulator (pwm), and three can 2.0 a, b software compatible modules (mscan12). system resource mapping, clock generation, interrupt control and bus interfacing are managed by the lite integration module (lim). the mc68hc912dt128a has full 16-bit data paths throughout, however, the external bus can operate in an 8-bit narrow mode so single 8-bit wide memory can be interfaced for lower cost systems. the inclusion of a pll circuit allows power consumption and performance to be adjusted to suit operational requirements. in addition to the i/o ports available in each module, 16 i/o ports are available with key-wake-up capability from stop or wait mode. the mc68hc912dg128a device is similar to the mc68hc912dt128a, but it has only two mscan12 modules. the entire databook applies also to the mc68hc912dg128a, except where differences are noted. 1-gen
general description mc68hc912dt128a rev 2.0 14 general description motorola features  16-bit cpu12 ? upward compatible with m68hc11 instruction set ? interrupt stacking and programmer ? s model identical to m68hc11 ? 20-bit alu ? instruction queue ? enhanced indexed addressing  multiplexed bus ? single chip or expanded ? 16 address/16 data wide or 16 address/8 data narrow modes  memory ? 128k byte flash eeprom, made of four 32k byte modules with 8k bytes protected boot section in each module ? 2k byte eeprom ? 8k byte ram with vstby, made of two 4k byte modules.  two analog-to-digital converters ? 2 times 8-channels, 10-bit resolution  three 1m bit per second, can 2.0 a, b software compatible modules on the mc68hc912dt128a (two on the mc68hc912dg128a) ? two receive and three transmit buffers per can ? flexible identifier filter programmable as 2 x 32 bit, 4 x 16 bit or 8x8bit ? four separate interrupt channels for rx, tx, error and wake-up per can ? low-pass filter wake-up function ? loop-back for self test operation 2--gen
general description features mc68hc912dt128a rev 2.0 motorola general description 15 ? programmable link to a timer input capture channel, for time-stamping and network synchronization.  enhanced capture timer (ect) ? 16-bit main counter with 7-bit prescaler ? 8 programmable input capture or output compare channels; 4 of the 8 input captures with buffer ? input capture filters and buffers, three successive captures on four channels, or two captures on four channels with a capture/compare selectable on the remaining four ? four 8-bit or two 16-bit pulse accumulators ? 16-bit modulus down-counter with 4-bit prescaler ? four user-selectable delay counters for signal filtering  4 pwm channels with programmable period and duty cycle ? 8-bit 4-channel or 16-bit 2-channel ? separate control for each pulse width and duty cycle ? center- or left-aligned outputs ? programmable clock select logic with a wide range of frequencies  serial interfaces ? two asynchronous serial communications interfaces (sci) ? inter ic bus interface (i 2 c) ? synchronous serial peripheral interface (spi)  lim (lite integration module) ? wcr (windowed cop watchdog, real time interrupt, clock monitor) ? roc (reset and clocks) ? mebi (multiplexed external bus interface) ? mmi (memory map and interface) ? int (interrupt control) 3-gen
general description mc68hc912dt128a rev 2.0 16 general description motorola ? bkp (breakpoints) ? bdm (background debug mode)  two 8-bit ports with key wake-up interrupt  clock generation ? phase-locked loop clock frequency multiplier ? limp home mode in absence of external clock ? slow mode divider ? low power 0.5 to 16 mhz crystal oscillator reference clock  112-pin tqfp package ? up to 67 general-purpose i/o lines on the mc68hc912dt128a (up to 69 on the mc68hc912dg128a), plus up to 18 input-only lines ? 5.0v operation at 8 mhz  development support ? single-wire background debug ? mode (bdm) ? on-chip hardware breakpoints 4-gen
general description mc68hc912dt128a block diagram mc68hc912dt128a rev 2.0 motorola general description 17 mc68hc912dt128a block diagram figure 1 mc68hc912dt128a block diagram txcan0 ddrh porth kwh4 kwh3 kwh2 kwh1 kwh0 kwh7 kwh6 kwh5 ph4 ph3 ph2 ph1 ph0 ph7 ph6 ph5 ddrj portj pj4 pj3 pj2 pj1 pj0 pj7 pj6 pj5 kwj4 kwj3 kwj2 kwj1 kwj0 kwj7 kwj6 kwj5 ioc0 ioc1 ioc2 ioc3 ioc4 ioc5 ioc6 ioc7 ddrt port t 128k byte flash eeprom 8k byte ram port e enhanced pt0 pt1 pt2 pt3 pt4 pt5 pt6 pt7 spi ddrs port s port ad1 pe1 pe2 pe4 pe5 pe6 pe3 pad13 pad14 pad15 pad16 pad17 vdda vssa vrh1 vrl1 pad10 pad11 pad12 reset extal xtal pw0 pw1 pw2 pw3 pwm ddrp port p pp0 pp1 pp2 pp3 vdd 2 vss 2 sci0 rxd0 txd0 rxd1 txd1 sdi/miso sdo/mosi sck ss ps0 ps1 ps2 ps3 ps4 ps5 ps6 ps7 2k byte eeprom pe0 pe7 an13 an14 an15 an16 an17 vdda vssa vrh1 vrl1 an10 an11 an12 bkgd eclk r/w lstrb moda modb xirq dbe/ cal capture timer lite irq sci1 integration module (lim) cpu12 periodic interrupt cop watchdog clock monitor single-wire background debug module breakpoints pll vsspll xfc vddpll can0 rxcan0 ddra port a ddrb port b pa4 pa3 pa2 pa1 pa0 pa7 pa6 pa5 pb4 pb3 pb2 pb1 pb0 pb7 pb6 pb5 data15 multiplexed address/data bus a d d r 1 5 a d d r 1 4 a d d r 1 3 a d d r 1 2 a d d r 1 1 a d d r 1 0 a d d r 9 a d d r 8 data14 data13 data12 data11 data10 data9 data8 a d d r 7 a d d r 6 a d d r 5 a d d r 4 a d d r 3 a d d r 2 a d d r 1 a d d r 0 data7 data6 data5 data4 data3 data2 data1 data0 atd1 port ad0 pad03 pad04 pad05 pad06 pad07 vrh0 vrl0 pad00 pad01 pad02 an03 an04 an05 an06 an07 vdda vssa vrh0 vrl0 an00 an01 an02 atd0 ppage data7 data6 data5 data4 data3 data2 data1 data0 wide bus narrow bus vddx 2 vssx 2 power for internal circuitry power for i/o drivers pk0 pk1 pk2 pk3 vstby iic scl sda pib7 pib6 ddrk port k pix0 pix1 pix2 ecs kwu clock generation module pk7 i/o txcan1 can1 rxcan1 txcan2 can2 rxcan2 ddrib port ib 5-gen
general description mc68hc912dt128a rev 2.0 18 general description motorola mc68hc912dg128a block diagram figure 2 mc68hc912dg128a block diagram txcan1 ddrh porth kwh4 kwh3 kwh2 kwh1 kwh0 kwh7 kwh6 kwh5 ph4 ph3 ph2 ph1 ph0 ph7 ph6 ph5 ddrj portj pj4 pj3 pj2 pj1 pj0 pj7 pj6 pj5 kwj4 kwj3 kwj2 kwj1 kwj0 kwj7 kwj6 kwj5 ioc0 ioc1 ioc2 ioc3 ioc4 ioc5 ioc6 ioc7 ddrt port t 128k byte flash eeprom 8k byte ram port e enhanced pt0 pt1 pt2 pt3 pt4 pt5 pt6 pt7 spi ddrs port s port ad1 pe1 pe2 pe4 pe5 pe6 pe3 pad13 pad14 pad15 pad16 pad17 vdda vssa vrh1 vrl1 pad10 pad11 pad12 reset extal xtal pw0 pw1 pw2 pw3 pwm ddrp port p pp0 pp1 pp2 pp3 vdd 2 vss 2 sci0 rxd0 txd0 rxd1 txd1 sdi/miso sdo/mosi sck ss ps0 ps1 ps2 ps3 ps4 ps5 ps6 ps7 2k byte eeprom pe0 pe7 an13 an14 an15 an16 an17 vdda vssa vrh1 vrl1 an10 an11 an12 bkgd eclk r/w lstrb moda modb xirq dbe/ cal capture timer lite irq pib5 pib4 sci1 integration module (lim) cpu12 periodic interrupt cop watchdog clock monitor single-wire background debug module breakpoints pll vsspll xfc vddpll can1 rxcan1 ddra port a ddrb port b pa4 pa3 pa2 pa1 pa0 pa7 pa6 pa5 pb4 pb3 pb2 pb1 pb0 pb7 pb6 pb5 data15 multiplexed address/data bus a d d r 1 5 a d d r 1 4 a d d r 1 3 a d d r 1 2 a d d r 1 1 a d d r 1 0 a d d r 9 a d d r 8 data14 data13 data12 data11 data10 data9 data8 a d d r 7 a d d r 6 a d d r 5 a d d r 4 a d d r 3 a d d r 2 a d d r 1 a d d r 0 data7 data6 data5 data4 data3 data2 data1 data0 atd1 port ad0 pad03 pad04 pad05 pad06 pad07 vrh0 vrl0 pad00 pad01 pad02 an03 an04 an05 an06 an07 vdda vssa vrh0 vrl0 an00 an01 an02 atd0 ppage data7 data6 data5 data4 data3 data2 data1 data0 wide bus narrow bus vddx 2 vssx 2 power for internal circuitry power for i/o drivers pk0 pk1 pk2 pk3 vstby iic scl sda pib7 pib6 ddrk port k pix0 pix1 pix2 ecs ddrib portib kwu clock generation module i/o pk7 i/o txcan0 can0 rxcan0 6-gen
general description ordering information mc68hc912dt128a rev 2.0 motorola general description 19 7-gen ordering information table 1 device ordering information package temperature voltage frequency order number range designator 112-pin tqfp ? 40 to +85 cc 5v 8 mhz consult factory ? 40 to +105 cv ? 40 to +125 cm table 2 development tools ordering information description details order number evaluation board kit evb and user's manual only m68evb912dg128 serial debug interface low voltage serial debug interface cable can be ordered separately m68sdil12 complete evaluation board kit evb, mcuez debug software, sdil low voltage serial debug interface cable m68kit912dg128 adapter 112 pin tqfp adapter is also available. m68adp912dg128pv
general description mc68hc912dt128a rev 2.0 20 general description motorola 8-gen
mc68hc912dt128a rev 2.0 motorola central processing unit 21 central processing unit central processing unit contents introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 programming model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 data types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 addressing modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 indexed addressing modes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 opcodes and operands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 introduction the cpu12 is a high-speed, 16-bit processing unit. it has full 16-bit data paths and wider internal registers (up to 20 bits) for high-speed extended math instructions. the instruction set is a proper superset of the m68hc11instruction set. the cpu12 allows instructions with odd byte counts, including many single-byte instructions. this provides efficient use of rom space. an instruction queue buffers program information so the cpu always has immediate access to at least three bytes of machine code at the start of every instruction. the cpu12 also offers an extensive set of indexed addressing capabilities. 1-cpu12
central processing unit mc68hc912dt128a rev 2.0 22 central processing unit motorola programming model cpu12 registers are an integral part of the cpu and are not addressed as if they were memory locations. figure 3 programming model accumulators a and b are general-purpose 8-bit accumulators used to hold operands and results of arithmetic calculations or data manipulations. some instructions treat the combination of these two 8-bit accumulators as a 16-bit double accumulator (accumulator d). index registers x and y are used for indexed addressing mode. in the indexed addressing mode, the contents of a 16-bit index register are added to 5-bit, 9-bit, or 16-bit constants or the content of an accumulator to form the effective address of the operand to be used in the instruction. 7 15 15 15 15 15 d ix iy sp pc ab n sxh i zvc 0 0 0 0 0 0 7 0 condition code register 8-bit accumulators a & b 16-bit double accumulator d index register x index register y stack pointer program counter or 2--cpu12
central processing unit data types mc68hc912dt128a rev 2.0 motorola central processing unit 23 stack pointer (sp) points to the last stack location used. the cpu12 supports an automatic program stack that is used to save system context during subroutine calls and interrupts, and can also be used for temporary storage of data. the stack pointer can also be used in all indexed addressing modes. program counter is a 16-bit register that holds the address of the next instruction to be executed. the program counter can be used in all indexed addressing modes except autoincrement/decrement. condition code register (ccr) contains five status indicators, two interrupt masking bits, and a stop disable bit. the five flags are half carry (h), negative (n), zero (z), overflow (v), and carry/borrow (c). the half-carry flag is used only for bcd arithmetic operations. the n, z, v, and c status bits allow for branching based on the results of a previous operation. data types the cpu12 supports the following data types:  bit data  8-bit and 16-bit signed and unsigned integers  16-bit unsigned fractions  16-bit addresses a byte is eight bits wide and can be accessed at any byte location. a word is composed of two consecutive bytes with the most significant byte at the lower value address. there are no special requirements for alignment of instructions or operands. 3-cpu12
central processing unit mc68hc912dt128a rev 2.0 24 central processing unit motorola addressing modes addressing modes determine how the cpu accesses memory locations to be operated upon. the cpu12 includes all of the addressing modes of the m68hc11 cpu as well as several new forms of indexed addressing. table 3 is a summary of the available addressing modes. table 3 m68hc12 addressing mode summary addressing mode source format abbreviation description inherent inst (no externally supplied operands) inh operands (if any) are in cpu registers immediate inst # opr8i or inst # opr16i imm operand is included in instruction stream 8- or 16-bit size implied by context direct inst opr8a dir operand is the lower 8-bits of an address in the range $0000 ? $00ff extended inst opr16a ext operand is a 16-bit address relative inst rel8 or inst rel16 rel an 8-bit or 16-bit relative offset from the current pc is supplied in the instruction indexed (5-bit offset) inst oprx5 , xysp idx 5-bit signed constant offset from x, y, sp, or pc indexed (auto pre-decrement) inst oprx3 , ? xys idx auto pre-decrement x, y, or sp by 1 ~ 8 indexed (auto pre-increment) inst oprx3 ,+ xys idx auto pre-increment x, y, or sp by 1 ~ 8 indexed (auto post- decrement) inst oprx3 , xys ? idx auto post-decrement x, y, or sp by 1 ~ 8 indexed (auto post-increment) inst oprx3 , xys + idx auto post-increment x, y, or sp by 1 ~ 8 indexed (accumulator offset) inst abd , xysp idx indexed with 8-bit (a or b) or 16-bit (d) accumulator offset from x, y, sp, or pc indexed (9-bit offset) inst oprx9 , xysp idx1 9-bit signed constant offset from x, y, sp, or pc (lower 8-bits of offset in one extension byte) indexed (16-bit offset) inst oprx16 , xysp idx2 16-bit constant offset from x, y, sp, or pc (16-bit offset in two extension bytes) indexed-indirect (16-bit offset) inst [ oprx16 , xysp ] [idx2] pointer to operand is found at... 16-bit constant offset from x, y, sp, or pc (16-bit offset in two extension bytes) indexed-indirect (d accumulator offset) inst [d, xysp ] [d,idx] pointer to operand is found at... x, y, sp, or pc plus the value in d 4-cpu12
central processing unit indexed addressing modes mc68hc912dt128a rev 2.0 motorola central processing unit 25 indexed addressing modes the cpu12 indexed modes reduce execution time and eliminate code size penalties for using the y index register. cpu12 indexed addressing uses a postbyte plus zero, one, or two extension bytes after the instruction opcode. the postbyte and extensions do the following tasks:  specify which index register is used.  determine whether a value in an accumulator is used as an offset.  enable automatic pre- or post-increment or decrement  specify use of 5-bit, 9-bit, or 16-bit signed offsets. table 4 summary of indexed operations postbyte code (xb) source code syntax comments rr0nnnnn ,r n,r ? n,r 5-bit constant offset n = ? 16 to +15 rr can specify x, y, sp, or pc 111rr0zs n,r ? n,r constant offset (9- or 16-bit signed) z-0 = 9-bit with sign in lsb of postbyte(s) 1 = 16-bit if z = s = 1, 16-bit offset indexed-indirect (see below) rr can specify x, y, sp, or pc 111rr011 [n,r] 16-bit offset indexed-indirect rr can specify x, y, sp, or pc rr1pnnnn n, ? r n,+r n,r ? n,r+ auto pre-decrement/increment or auto post-decrement/increment ; p = pre-(0) or post-(1), n = ? 8 to ? 1, +1 to +8 rr can specify x, y, or sp (pc not a valid choice) 111rr1aa a,r b,r d,r accumulator offset (unsigned 8-bit or 16-bit) aa-00 = a 01 = b 10 = d (16-bit) 11 = see accumulator d offset indexed-indirect rr can specify x, y, sp, or pc 111rr111 [d,r] accumulator d offset indexed-indirect rr can specify x, y, sp, or pc 5-cpu12
central processing unit mc68hc912dt128a rev 2.0 26 central processing unit motorola opcodes and operands the cpu12 uses 8-bit opcodes. each opcode identifies a particular instruction and associated addressing mode to the cpu. several opcodes are required to provide each instruction with a range of addressing capabilities. only 256 opcodes would be available if the range of values were restricted to the number that can be represented by 8-bit binary numbers. to expand the number of opcodes, a second page is added to the opcode map. opcodes on the second page are preceded by an additional byte with the value $18. to provide additional addressing flexibility, opcodes can also be followed by a postbyte or extension bytes. postbytes implement certain forms of indexed addressing, transfers, exchanges, and loop primitives. extension bytes contain additional program information such as addresses, offsets, and immediate data. 6-cpu12
mc68hc912dt128a rev 2.0 motorola pinout and signal descriptions 27 pinout and signal descriptions pinout and signal descriptions contents mc68hc912dt128a pin assignments in 112-pin qfp . . . . . . . . . . . 27 power supply pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 signal descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 port signals. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 mc68hc912dt128a pin assignments in 112-pin qfp the mc68hc912dt128a is available in a 112-pin thin quad flat pack (tqfp). most pins perform two or more functions, as described in the signal descriptions . figure 4 shows pin assignments. in expanded narrow modes the lower byte data is multiplexed with higher byte data through pins 57-64. 1-pins
pinout and signal descriptions mc68hc912dt128a rev 2.0 28 pinout and signal descriptions motorola figure 4 pin assignments in 112-pin qfp for mc68hc912dt128a 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 112 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 mc68hc912dt128a 112tqfp pad17/an17 pad07/an07 pad16/an16 pad06/an06 pad15/an15 pad05/an05 pad14/an14 pad04/an04 pad13/an13 pad03/an03 pad12/an12 pad02/an02 pad11/an11 pad01/an01 pad10/an10 pad00/an00 v rl0 v rh0 v ss v dd pa7/addr15/data15/data7 pa6/addr14/data14/data6 pa5/addr13/data13/data5 pa4/addr12/data12/data4 pa3/addr11/data11/data3 pa2/addr10/data10/data2 pa1/addr9/data9/data1 pa0/addr8/data8/data0 pp3/pw3 pk0/pix0 pk1/pix1 pk2/pix2 pk7/ecs v ddx v ssx rxcan0 txcan0 rxcan1 txcan1 rxcan2 txcan2 pib6/sda pib7/scl test ps7/ss ps6/sck ps5/sdo/mosi ps4/sdi/miso ps3/txd1 ps2/rxd1 ps1/txd0 ps0/rxd0 v ssa v rl1 v rh1 v dda pw2/pp2 pw1/pp1 pw0/pp0 ioc0/pt0 ioc1/pt1 ioc2/pt2 ioc3/pt3 kwj7/pj7 kwj6/pj6 kwj5/pj5 kwj4/pj4 v dd pk3 v ss ioc4/pt4 ioc5/pt5 ioc6/pt6 ioc7/pt7 kwj3/pj3 kwj2/pj2 kwj1/pj1 kwj0/pj0 smodn/taghi/ bkgd addr0/data0/pb0 addr1/data1/pb1 addr2/data2/pb2 addr3/data3/pb3 addr4/data4/pb4 addr5/data5/pb5 addr6/data6/pb6 addr7/data7/pb7 kwh7/ph7 kwh6/ph6 kwh5/ph5 kwh4/ph4 dbe/ cal/pe7 modb/ipipe1/pe6 moda/ipipe0/pe5 eclk/pe4 v ssx vstby v ddx v ddpll xfc v sspll reset extal xtal kwh3/ph3 kwh2/ph2 kwh1/ph1 kwh0/ph0 lstrb /taglo /pe3 r/w /pe2 irq /pe1 xirq /pe0 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 note: test = on early production devices this pin is used for factory test purposes. it is recommended that this pin is not connected within the application, but it may be connected to vss or 5.5v max without issue. on later production devices this pin is not bonded out. 2-pins
pinout and signal descriptions mc68hc912dt128a pin assignments in 112-pin qfp mc68hc912dt128a rev 2.0 motorola pinout and signal descriptions 29 figure 5 pin assignments in 112-pin qfp for mc68hc912dg128a 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 112 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 mc68hc912dg128a 112tqfp pad17/an17 pad07/an07 pad16/an16 pad06/an06 pad15/an15 pad05/an05 pad14/an14 pad04/an04 pad13/an13 pad03/an03 pad12/an12 pad02/an02 pad11/an11 pad01/an01 pad10/an10 pad00/an00 v rl0 v rh0 v ss v dd pa7/addr15/data15/data7 pa6/addr14/data14/data6 pa5/addr13/data13/data5 pa4/addr12/data12/data4 pa3/addr11/data11/data3 pa2/addr10/data10/data2 pa1/addr9/data9/data1 pa0/addr8/data8/data0 pp3/pw3 pk0/pix0 pk1/pix1 pk2/pix2 pk7/ecs v ddx v ssx rxcan0 txcan0 rxcan1 txcan1 pib4 pib5 pib6/sda pib7/scl test ps7/ss ps6/sck ps5/sdo/mosi ps4/sdi/miso ps3/txd1 ps2/rxd1 ps1/txd0 ps0/rxd0 v ssa v rl1 v rh1 v dda pw2/pp2 pw1/pp1 pw0/pp0 ioc0/pt0 ioc1/pt1 ioc2/pt2 ioc3/pt3 kwj7/pj7 kwj6/pj6 kwj5/pj5 kwj4/pj4 v dd pk3 v ss ioc4/pt4 ioc5/pt5 ioc6/pt6 ioc7/pt7 kwj3/pj3 kwj2/pj2 kwj1/pj1 kwj0/pj0 smodn/taghi/ bkgd addr0/data0/pb0 addr1/data1/pb1 addr2/data2/pb2 addr3/data3/pb3 addr4/data4/pb4 addr5/data5/pb5 addr6/data6/pb6 addr7/data7/pb7 kwh7/ph7 kwh6/ph6 kwh5/ph5 kwh4/ph4 eclk /dbe/ cal/pe7 cgmtst/modb/ipipe1/pe6 moda/ipipe0/pe5 eclk/pe4 v ssx vstby v ddx v ddpll xfc v sspll reset extal xtal kwh3/ph3 kwh2/ph2 kwh1/ph1 kwh0/ph0 lstrb /taglo /pe3 r/w /pe2 irq /pe1 xirq /pe0 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 note: test = on early production devices this pin is used for factory test purposes. it is recommended that this pin is not connected within the application, but it may be connected to vss or 5.5v max without issue. on later production devices this pin is not bonded out. 3-pins
pinout and signal descriptions mc68hc912dt128a rev 2.0 30 pinout and signal descriptions motorola figure 3 112-pin qfp mechanical dimensions (case no. 987) dim a min max 20.000 bsc millimeters a1 10.000 bsc b 20.000 bsc b1 10.000 bsc c --- 1.600 c1 0.050 0.150 c2 1.350 1.450 d 0.270 0.370 e 0.450 0.750 f 0.270 0.330 g 0.650 bsc j 0.090 0.170 k 0.500 ref p 0.325 bsc r1 0.100 0.200 r2 0.100 0.200 s 22.000 bsc s1 11.000 bsc v 22.000 bsc v1 11.000 bsc y 0.250 ref z 1.000 ref aa 0.090 0.160 11 11 13 7 13 view y l-m 0.20 n t 4x 4x 28 tips pin 1 ident 1 112 85 84 28 57 29 56 b v v1 b1 a1 s1 a s view ab 0.10 3 c c2 2 0.050 seating plane gage plane 1 view ab c1 (z) (y) e (k) r2 r1 0.25 j1 view y j1 p g 108x 4x section j1-j1 base rotated 90 counterclockwise metal j aa f d l-m m 0.13 n t 1 2 3 c l l-m 0.20 n t l n m t t 112x x x=l, m or n r r 8 3 0 notes: 1. dimensioning and tolerancing per asme y14.5m, 1994. 2. dimensions in millimeters. 3. datums l, m and n to be determined at seating plane, datum t. 4. dimensions s and v to be determined at seating plane, datum t. 5. dimensions a and b do not include mold protrusion. allowable protrusion is 0.25 per side. dimensions a and b include mold mismatch. 6. dimension d does not include dambar protrusion. allowable dambar protrusion shall not cause the d dimension to exceed 0.46. 4-pins
pinout and signal descriptions power supply pins mc68hc912dt128a rev 2.0 motorola pinout and signal descriptions 31 power supply pins mc68hc912dt128a power and ground pins are described below and summarized in table 5 . all power supply pins must be connected to appropriate supplies. on no account must any pins be left floating. internal power (v dd ) and ground (v ss ) power is supplied to the mcu through v dd and v ss . because fast signal transitions place high, short-duration current demands on the power supply, use bypass capacitors with high-frequency characteristics and place them as close to the mcu as possible. external power (v ddx ) and ground (v ssx ) external power and ground for i/o drivers. because fast signal transitions place high, short-duration current demands on the power supply, use bypass capacitors with high-frequency characteristics and place them as close to the mcu as possible. bypass requirements depend on how heavily the mcu pins are loaded. v dda , v ssa provides operating voltage and ground for the analog-to-digital converter. this allows the supply voltage to the a/d to be bypassed independently. analog to digital reference voltages (v rh , v rl ) v rh0 , v rl0 : reference voltage high and low for atd converter 0. v rh1 , v rl1 : reference voltage high and low for atd converter 1. if the atd modules are not used, leaving v rh connected to v dd will not result in an increase of power consumption. v ddpll , v sspll provides operating voltage and ground for the phase-locked loop. this allows the supply voltage to the pll to be bypassed independently. 5-pins
pinout and signal descriptions mc68hc912dt128a rev 2.0 32 pinout and signal descriptions motorola note: the vsspll pin should always be grounded even if the pll is not used. the vddpll pin should not be left floating. it is recommended to connect the vddpll pin to ground if the pll is not used. xfc pll loop filter. please see appendix b: cgm practical aspects for information on how to calculate pll loop filter elements. any current leakage on this pin must be avoided. figure 7 pll loop filter connections v stby stand-by voltage supply to static ram. used to maintain the contents of ram with minimal power when the rest of the chip is powered down. mcu xfc r 0 c 0 c a vddpll vddpll table 5 mc68hc912dt128a power and ground connection summary mnemonic pin number description 112-pin qfp v dd 12, 65 internal power and ground. v ss 14, 66 v ddx 42, 107 external power and ground, supply to pin drivers. v ssx 40, 106 v dda 85 operating voltage and ground for the analog-to-digital converter, allows the supply voltage to the a/d to be bypassed independently. v ssa 88 v rh1 86 reference voltages for the analog-to-digital converter 1 v rl1 87 v rh0 67 reference voltages for the analog-to-digital converter 0. v rl0 68 6-pins
pinout and signal descriptions signal descriptions mc68hc912dt128a rev 2.0 motorola pinout and signal descriptions 33 7-pins signal descriptions crystal driver and external clock input (xtal, extal) these pins provide the interface for either a crystal or a cmos compatible clock to control the internal clock generator circuitry. out of reset the frequency applied to extal is twice the desired e ? clock rate. all the device clocks are derived from the extal input frequency. please see appendix b: cgm practical aspects for detailed information on oscillator design. note: the crystal circuit for colpitts oscillator is changed from the standard pierce oscillator. note: the internal return path for the oscillator is the vsspll pin. therefore it is recommended to connect the common node of the resonator and the capacitor directly to the vsspll pin. figure 8 common crystal connections v ddpll 43 provides operating voltage and ground for the phase-locked loop. this allows the supply voltage to the pll to be bypassed independently. v sspll 45 v stby 41 stand-by voltage supply to maintain the contents of ram with minimal power when the rest of the chip is powered down. table 5 mc68hc912dt128a power and ground connection summary mnemonic pin number description 112-pin qfp c mcu c extal xtal 2 x e crystal or ceramic resonator c dc * due to the nature of the translated ground colpitts oscillator a please contact the crystal manufacturer for specific dc bias dc voltage bias is applied to the crystal. conditions and recommended capacitance value (if applicable). *
pinout and signal descriptions mc68hc912dt128a rev 2.0 34 pinout and signal descriptions motorola figure 9 external oscillator connections xtal is the crystal output.the xtal pin must be left without terminal when an external cmos compatible clock input is connected to the extal pin. the xtal output is normally intended to drive only a crystal. the xtal output can be buffered with a high-impedance buffer to drive the extal input of another device. in all cases take extra care in the circuit board layout around the oscillator pins. load capacitances in the oscillator circuits include all stray layout capacitances. refer to figure 8 and figure 9 for diagrams of oscillator circuits. e-clock output (eclk) eclk is the output connection for the internal bus clock. it is used to demultiplex the address and data in expanded modes and is used as a timing reference. eclk frequency is equal to 1/2 the crystal frequency out of reset. the e-clock output is turned off in single chip user mode to reduce the effects of rfi. it can be turned on if necessary. in special single-chip mode, the e-clock is turned on at reset and can be turned off. in special peripheral mode the e-clock is an input to the mcu. all clocks, including the e clock, are halted when the mcu is in stop mode. it is possible to configure the mcu to interface to slow external memory. eclk can be stretched for such accesses. reset (reset ) an active low bidirectional control signal, reset , acts as an input to initialize the mcu to a known start-up state. it also acts as an open-drain output to indicate that an internal failure has been detected in either the clock monitor or cop watchdog circuit. the mcu goes into reset asynchronously and comes out of reset synchronously. this allows the nc mcu extal xtal 2 x e cmos-compatible external oscillator 8-pins
pinout and signal descriptions signal descriptions mc68hc912dt128a rev 2.0 motorola pinout and signal descriptions 35 9-pins part to reach a proper reset state even if the clocks have failed, while allowing synchronized operation when starting out of reset. it is important to use an external low-voltage reset circuit (such as mc34064 or mc34164) to prevent corruption of ram or eeprom due to power transitions. the reset sequence is initiated by any of the following events:  power-on-reset (por)  cop watchdog enabled and watchdog timer times out  clock monitor enabled and clock monitor detects slow or stopped clock  user applies a low level to the reset pin external circuitry connected to the reset pin should not include a large capacitance that would interfere with the ability of this signal to rise to a valid logic one within nine bus cycles after the low drive is released. upon detection of any reset, an internal circuit drives the reset pin low and a clocked reset sequence controls when the mcu can begin normal processing. in the case of por or a clock monitor error, a 4096 cycle oscillator startup delay is imposed before the reset recovery sequence starts (reset is driven low throughout this 4096 cycle delay). the internal reset recovery sequence then drives reset low for 16 to 17 cycles and releases the drive to allow reset to rise. nine cycles later this circuit samples the reset pin to see if it has risen to a logic one level. if reset is low at this point, the reset is assumed to be coming from an external request and the internally latched states of the cop timeout and clock monitor failure are cleared so the normal reset vector ($fffe:ffff) is taken when reset is finally released. if reset is high after this nine cycle delay, the reset source is tentatively assumed to be either a cop failure or a clock monitor fail. if the internally latched state of the clock monitor fail circuit is true, processing begins by fetching the clock monitor vector ($fffc:fffd). if no clock monitor failure is indicated, and the latched state of the cop timeout is true, processing begins by fetching the cop vector ($fffa:fffb). if neither clock monitor fail nor cop timeout are pending, processing begins by fetching the normal reset vector ($fffe:ffff).
pinout and signal descriptions mc68hc912dt128a rev 2.0 36 pinout and signal descriptions motorola maskable interrupt request (irq ) the irq input provides a means of applying asynchronous interrupt requests to the mcu. either falling edge-sensitive triggering or level-sensitive triggering is program selectable (intcr register). irq is always enabled and configured to level-sensitive triggering at reset. it can be disabled by clearing irqen bit (intcr register). when the mcu is reset the irq function is masked in the condition code register. this pin is always an input and can always be read. there is an active pull-up on this pin while in reset and immediately out of reset. the pullup can be turned off by clearing pupe in the pucr register. nonmaskable interrupt (xirq ) the xirq input provides a means of requesting a nonmaskable interrupt after reset initialization. during reset, the x bit in the condition code register (ccr) is set and any interrupt is masked until mcu software enables it. because the xirq input is level sensitive, it can be connected to a multiple-source wired-or network. this pin is always an input and can always be read. there is an active pull-up on this pin while in reset and immediately out of reset. the pullup can be turned off by clearing pupe in the pucr register. xirq is often used as a power loss detect interrupt. whenever xirq or irq are used with multiple interrupt sources (irq must be configured for level-sensitive operation if there is more than one source of irq interrupt), each source must drive the interrupt input with an open-drain type of driver to avoid contention between outputs. there must also be an interlock mechanism at each interrupt source so that the source holds the interrupt line low until the mcu recognizes and acknowledges the interrupt request. if the interrupt line is held low, the mcu will recognize another interrupt as soon as the interrupt mask bit in the mcu is cleared (normally upon return from an interrupt). mode select (smodn, moda, and modb) the state of these pins during reset determine the mcu operating mode. after reset, moda and modb can be configured as instruction queue tracking signals ipipe0 and ipipe1 in expanded modes. moda and modb have active pulldowns during reset. the smodn pin has an active pullup when configured as an input. the pin can be used as bkgd or taghi after reset. 10-pins
pinout and signal descriptions signal descriptions mc68hc912dt128a rev 2.0 motorola pinout and signal descriptions 37 11-pins single-wire background mode pin (bkgd) the bkgd pin receives and transmits serial background debugging commands. a special self-timing protocol is used. the bkgd pin has an active pullup when configured as an input; bkgd has no pullup control. refer to development support . external address and data buses (addr[15:0] and data[15:0]) external bus pins share functions with general-purpose i/o ports a and b. in single-chip operating modes, the pins can be used for i/o; in expanded modes, the pins are used for the external buses. in expanded wide mode, ports a and b are used for multiplexed 16-bit data and address buses. pa[7:0] correspond to addr[15:8]/data[15:8]; pb[7:0] correspond to addr[7:0]/data[7:0]. in expanded narrow mode, ports a and b are used for the16-bit address bus, and an 8-bit data bus is multiplexed with the most significant half of the address bus on port a. in this mode, 16-bit data is handled as two back-to-back bus cycles, one for the high byte followed by one for the low byte. pa[7:0] correspond to addr[15:8] and to data[15:8] or data[7:0], depending on the bus cycle. the state of the address pins should be latched at the rising edge of e. to allow for maximum address setup time at external devices, a transparent latch should be used. read/write (r/w ) in all modes this pin can be used as a general-purpose i/o and is an input with an active pull-up out of reset. if the read/write function is required it should be enabled by setting the rdwe bit in the pear register. external writes will not be possible until enabled. low-byte strobe (lstrb) in all modes this pin can be used as a general-purpose i/o and is an input with an active pull-up out of reset. if the strobe function is required, it should be enabled by setting the lstre bit in the pear register. this signal is used in write operations. therefore external low byte writes will not be possible until this function is enabled. this pin is also used as taglo in special expanded modes and is multiplexed with the lstrb function.
pinout and signal descriptions mc68hc912dt128a rev 2.0 38 pinout and signal descriptions motorola instruction queue tracking signals (ipipe1 and ipipe0) ipipe1 (pe6) and ipipe0 (pe5) signals are used to track the state of the internal instruction queue. data movement and execution state information is time-multiplexed on the two signals. refer to development support . data bus enable (dbe ) the dbe pin (pe7) is an active low signal that will be asserted low during e-clock high time. dbe provides separation between output of a multiplexed address and the input of data. when an external address is stretched, dbe is asserted during what would be the last quarter cycle of the last e-clock cycle of stretch. in expanded modes this pin is used to enable the drive control of external buses during external reads. use of the dbe is controlled by the ndbe bit in the pear register. dbe is enabled out of reset in expanded modes. inverted e clock (eclk ) the eclk pin (pe7) can be used to latch the address for de-multiplexing. it has the same behavior as the eclk, except is inverted. in expanded modes this pin is used to enable the drive control of external buses during external reads. use of the eclk is controlled by the ndbe and dbene bits in the pear register. calibration reference (cal) the cal pin (pe7) is the output of the slow mode programmable clock divider, slwclk, and is used as a calibration reference. the slwclk frequency is equal to the crystal frequency out of reset and always has a 50% duty. if the dbe function is enabled it will override the enabled cal output. the cal pin output is disabled by clearing cale bit in the pear register. clock generation module test(cgmtst) the cgmtst pin (pe6) is the output of the clocks tested when cgmte bit is set in pear register. the pipoe bit must be cleared for the clocks to be tested 12-pins
pinout and signal descriptions signal descriptions mc68hc912dt128a rev 2.0 motorola pinout and signal descriptions 39 13-pins table 6 mc68hc912dt128a signal description summary pin name shared port pin number description 112-pin extal - 47 crystal driver and external clock input pins. on reset all the device clocks are derived from the extal input frequency. xtal is the crystal output. xtal - 48 reset - 46 an active low bidirectional control signal, reset acts as an input to initialize the mcu to a known start-up state, and an output when cop or clock monitor causes a reset. addr[7:0] data[7:0] pb[7:0] 31 ? 24 external bus pins share function with general-purpose i/o ports a and b. in single chip modes, the pins can be used for i/o. in expanded modes, the pins are used for the external buses. addr[15:8] data[15:8] pa[7:0] 64 ? 57 dbe pe7 36 data bus control and, in expanded mode, enables the drive control of external buses during external reads. eclk pe7 36 inverted e clock used to latch the address. cal pe7 36 cal is the output of the slow mode programmable clock divider, slwclk, and is used as a calibration reference for functions such as time of day. it is overridden when dbe function is enabled. it always has a 50% duty. cgmtst pe6 37 clock generation module test output. modb/ipipe1, moda/ipipe0 pe6, pe5 37, 38 state of mode select pins during reset determine the initial operating mode of the mcu. after reset, modb and moda can be configured as instruction queue tracking signals ipipe1 and ipipe0 or as general-purpose i/o pins. eclk pe4 39 e clock is the output connection for the external bus clock. eclk is used as a timing reference and for address demultiplexing. lstrb/taglo pe3 53 low byte strobe (0 = low byte valid), in all modes this pin can be used as i/o. the low strobe function is the exclusive-nor of a0 and the internal sz8 signal. (the sz8 internal signal indicates the size 16/8 access.) pin function taglo used in instruction tagging. see development support . r/w pe2 54 indicates direction of data on expansion bus. shares function with general-purpose i/o. read/write in expanded modes. irq pe1 55 maskable interrupt request input provides a means of applying asynchronous interrupt requests to the mcu. either falling edge-sensitive triggering or level-sensitive triggering is program selectable (intcr register). xirq pe0 56 provides a means of requesting asynchronous nonmaskable interrupt requests after reset initialization smodn/bkgd/ taghi -23 during reset, this pin determines special or normal operating mode. after reset, single-wire background interface pin is dedicated to the background debug function. pin function taghi used in instruction tagging. see development support .
pinout and signal descriptions mc68hc912dt128a rev 2.0 40 pinout and signal descriptions motorola ix[2:0] pk[2:0] 109-111 page index register emulation outputs. ecs pk7 108 emulation chip select. pw[3:0] pp[3:0] 112, 1 ? 3 pulse width modulator channel outputs. ss ps7 96 slave select output for spi master mode, input for slave mode or master mode. sck ps6 95 serial clock for spi system. sdo/mosi ps5 94 master out/slave in pin for serial peripheral interface sdi/miso ps4 93 master in/slave out pin for serial peripheral interface txd1 ps3 92 sci1 transmit pin rxd1 ps2 91 sci1 receive pin txd0 ps1 90 sci0 transmit pin rxd0 ps0 89 sci0 receive pin ioc[7:0] pt[7:0] 18 ? 15, 7 ? 4 pins used for input capture and output compare in the timer and pulse accumulator subsystem. an1[7:0] pad1[7:0] 84/82/80 /78/76/7 4/72/70 analog inputs for the analog-to-digital conversion module 1 an0[7:0] pad0[7:0] 83/81/79 /77/75/7 3/71/69 analog inputs for the analog-to-digital conversion module 0 txcan2 (1) -100 mscan2 transmit pin (mc68hc912dt128a only). leave unconnected if mscan2 is not used. rxcan2 (1) - 101 mscan2 receive pin (mc68hc912dt128a only). txcan1 - 102 mscan1 transmit pin. leave unconnected if mscan1 is not used. rxcan1 - 103 mscan1 receive pin. txcan0 - 104 mscan0 transmit pin. if the mscan is not used, leave unconnected if mscan0 is not used. rxcan0 - 105 mscan0 receive pin. scl pib7 98 i 2 c bus serial clock line pin sda pib6 99 i 2 c bus serial data line pin kwj[7:0] pj[7:0] 8 ? 11, 19 ? 22 key wake-up and general purpose i/o; can cause an interrupt when an input transitions from high to low or from low to high (kwpj). kwh[7:0] ph[7:0] 32 ? 35, 49 ? 52 key wake-up and general purpose i/o; can cause an interrupt when an input transitions from high to low or from low to high (kwph). 1 mc68hc912dt128a only table 6 mc68hc912dt128a signal description summary pin name shared port pin number description 112-pin 14-pins
pinout and signal descriptions port signals mc68hc912dt128a rev 2.0 motorola pinout and signal descriptions 41 15-pins port signals the mc68hc912dt128a incorporates eleven ports which are used to control and access the various device subsystems. when not used for these purposes, port pins may be used for general-purpose i/o. in addition to the pins described below, each port consists of a data register which can be read and written at any time, and, with the exception of port ad0, port ad1, pe[1:0], rxcan and txcan, a data direction register which controls the direction of each pin. after reset all general purpose i/o pins are configured as input. port a port a pins are used for address and data in expanded modes. when this port is not used for external access such as in single-chip mode, these pins can be used as general purpose i/o. the port data register is not in the address map during expanded and peripheral mode operation. when it is in the map, port a can be read or written at anytime. register ddra determines whether each port a pin is an input or output. ddra is not in the address map during expanded and peripheral mode operation. setting a bit in ddra makes the corresponding bit in port a an output; clearing a bit in ddra makes the corresponding bit in port a an input. the default reset state of ddra is all zeroes. when the pupa bit in the pucr register is set, all port a input pins are pulled-up internally by an active pull-up device. pucr is not in the address map in peripheral mode. setting the rdpa bit in register rdriv causes all port a outputs to have reduced drive level. rdriv can be written once after reset. rdriv is not in the address map in peripheral mode. refer to bus control and input/output . port b port b pins are used for address and data in expanded modes. when this port is not used for external access such as in single-chip mode, these pins can be used as general purpose i/o. the port data register is not in the address map during expanded and peripheral mode operation. when it is in the map, port b can be read or written at anytime.
pinout and signal descriptions mc68hc912dt128a rev 2.0 42 pinout and signal descriptions motorola register ddrb determines whether each port b pin is an input or output. ddrb is not in the address map during expanded and peripheral mode operation. setting a bit in ddrb makes the corresponding bit in port b an output; clearing a bit in ddrb makes the corresponding bit in port b an input. the default reset state of ddrb is all zeroes. when the pupb bit in the pucr register is set, all port b input pins are pulled-up internally by an active pull-up device. pucr is not in the address map in peripheral mode. setting the rdpb bit in register rdriv causes all port b outputs to have reduced drive level. rdriv can be written once after reset. rdriv is not in the address map in peripheral mode. refer to bus control and input/output . port e port e pins operate differently from port a and b pins. port e pins are used for bus control signals and interrupt service request signals. when a pin is not used for one of these specific functions, it can be used as general-purpose i/o. however, two of the pins (pe[1:0]) can only be used for input, and the states of these pins can be read in the port data register even when they are used for irq and xirq . the pear register determines pin function, and register ddre determines whether each pin is an input or output when it is used for general-purpose i/o. pear settings override ddre settings. because pe[1:0] are input-only pins, only ddre[7:2] have effect. setting a bit in the ddre register makes the corresponding bit in port e an output; clearing a bit in the ddre register makes the corresponding bit in port e an input. the default reset state of ddre is all zeroes. when the pupe bit in the pucr register is set, pe[7,3,2,1,0] are pulled up. pe[7,3,2,0] are active pull-up devices. pupcr is not in the address map in peripheral mode. neither port e nor ddre is in the map in peripheral mode or in the internal map in expanded modes with eme set. setting the rdpe bit in register rdriv causes all port e outputs to have reduced drive level. rdriv can be written once after reset. rdriv is not 16-pins
pinout and signal descriptions port signals mc68hc912dt128a rev 2.0 motorola pinout and signal descriptions 43 17-pins in the address map in peripheral mode. refer to bus control and input/output . port h port h pins are used for key wake-ups that can be used with the pins configured as inputs or outputs. the key wake-ups are triggered with either a rising or falling edge signal (kwph). an interrupt is generated if the corresponding bit is enabled (kwieh). if any of the interrupts is not enabled, the corresponding pin can be used as a general purpose i/o pin. refer to i/o ports with key wake-up . register ddrh determines whether each port h pin is an input or output. setting a bit in ddrh makes the corresponding bit in port h an output; clearing a bit in ddrh makes the corresponding bit in port h an input. the default reset state of ddrh is all zeroes. register kwph not only determines what type of edge the key wake ups are triggered, but it also determines what type of resistive load is used for port h input pins when puph bit is set in the pucr register. setting a bit in kwph makes the corresponding key wake up input pin trigger at rising edges and loads a pull down in the corresponding port h input pin. clearing a bit in kwph makes the corresponding key wake up input pin trigger at falling edges and loads a pull up in the corresponding port h input pin. the default state of kwph is all zeroes. setting the rdph bit in register rdriv causes all port h outputs to have reduced drive level. rdriv can be written once after reset. rdriv is not in the address map in peripheral mode. refer to bus control and input/output . port j port j pins are used for key wake-ups that can be used with the pins configured as inputs or outputs. the key wake-ups are triggered with either a rising or falling edge signal (kwpj). an interrupt is generated if the corresponding bit is enabled (kwiej). if any of the interrupts is not enabled, the corresponding pin can be used as a general purpose i/o pin. refer to i/o ports with key wake-up . register ddrj determines whether each port j pin is an input or output. setting a bit in ddrj makes the corresponding bit in port j an output;
pinout and signal descriptions mc68hc912dt128a rev 2.0 44 pinout and signal descriptions motorola clearing a bit in ddrj makes the corresponding bit in port j an input. the default reset state of ddrj is all zeroes. register kwpj not only determines what type of edge the key wake ups are triggered, but it also determines what type of resistive load is used for port j input pins when pupj bit is set in the pucr register. setting a bit in kwpj makes the corresponding key wake up input pin trigger at rising edges and loads a pull down in the corresponding port j input pin. clearing a bit in kwpj makes the corresponding key wake up input pin trigger at falling edges and loads a pull up in the corresponding port j input pin. the default state of kwpj is all zeroes. setting the rdpj bit in register rdriv causes all port j outputs to have reduced drive level. rdriv can be written once after reset. rdriv is not in the address map in peripheral mode. refer to bus control and input/output . port k port k pins are used for page index emulation in expanded or peripheral modes. when page index emulation is not enabled, emk is not set in mode register, or the part is in single chip mode, these pins can be used for general purpose i/o. port k bit 3 is used as a general purpose i/o pin only. the port data register is not in the address map during expanded and peripheral mode operation with emk set. when it is in the map, port k can be read or written at anytime. register ddrk determines whether each port k pin is an input or output. ddrk is not in the address map during expanded and peripheral mode operation with emk set. setting a bit in ddrk makes the corresponding bit in port k an output; clearing a bit in ddrk makes the corresponding bit in port k an input. the default reset state of ddrk is all zeroes. when the pupk bit in the pucr register is set, all port k input pins are pulled-up internally by an active pull-up device. pucr is not in the address map in peripheral mode. setting the rdpk bit in register rdriv causes all port k outputs to have reduced drive level. rdriv can be written once after reset. rdriv is not in the address map in peripheral mode. refer to bus control and input/output . 18-pins
pinout and signal descriptions port signals mc68hc912dt128a rev 2.0 motorola pinout and signal descriptions 45 19-pins port can2 (mc68hc912dt12 8a only) the mscan2 uses two external pins, one input (rxcan2) and one output (txcan2). the txcan2 output pin represents the logic level on the can: ? 0 ? is for a dominant state, and ? 1 ? is for a recessive state. rxcan2 is on bit 0 of port can2, txcan2 is on bit 1. if the mscan2 is not used, txcan2 should be left unconnected. port can1 the mscan1 uses two external pins, one input (rxcan1) and one output (txcan1). the txcan1 output pin represents the logic level on the can: ? 0 ? is for a dominant state, and ? 1 ? is for a recessive state. rxcan1 is on bit 0 of port can1, txcan1 is on bit 1. if the mscan1 is not used, txcan1 should be left unconnected. port can0 the mscan0 uses two external pins, one input (rxcan0) and one output (txcan0). the txcan0 output pin represents the logic level on the can: ? 0 ? is for a dominant state, and ? 1 ? is for a recessive state. rxcan0 is on bit 0 of port can0, txcan0 is on bit 1. if the mscan0 is not used, txcan0 should be left unconnected. port ib bidirectional pins to iic bus interface subsystem. the iic bus interface uses a serial data line (sda) and serial clock line (scl) for data transfer. the pins are connected to a positive voltage supply via a pull up resistor. the pull ups can be enabled internally or connected externally. the output stages have open drain outputs in order to perform the wired-and function. when the iic is disabled the pins can be used as general purpose i/o pins. scl is on bit 7 of port ib and sda is on bit 6. on the mc68hc912dg128a, the remaining two pins of port ib (pib5 and pib4) are controlled by registers in the iic address space. register ddrib determines pin direction of port ib when used for general-purpose i/o. when ddrib bits are set, the corresponding pin is configured for output. on reset the ddrib bits are cleared and the corresponding pin is configured for input. when the pupib bit in the ibpurd register is set, all input pins are pulled up internally by an active pull-up device. pullups are disabled after reset, except for input ports 0 through 5, which are always on regardless of pupib bit.
pinout and signal descriptions mc68hc912dt128a rev 2.0 46 pinout and signal descriptions motorola setting the rdpib bit in the ibpurd register configures all port ib outputs to have reduced drive levels. levels are at normal drive capability after reset. the ibpurd register can be read or written anytime after reset. refer to section inter-ic bus . port ad1 this port is an analog input interface to the analog-to-digital subsystem and used for general-purpose input. when analog-to-digital functions are not enabled, the port has eight general-purpose input pins, pad1[7:0]. the adpu bit in the atd1ctl2 register enables the a/d function. port ad1 pins are inputs; no data direction register is associated with this port. the port has no resistive input loads and no reduced drive controls. refer to analog-to-digital converter (atd) . port ad0 this port is an analog input interface to the analog-to-digital subsystem and used for general-purpose input. when analog-to-digital functions are not enabled, the port has eight general-purpose input pins, pad0[7:0]. the adpu bit in the atd0ctl2 register enables the a/d function. port ad0 pins are inputs; no data direction register is associated with this port. the port has no resistive input loads and no reduced drive controls. refer to analog-to-digital converter (atd) . port p the four pulse-width modulation channel outputs share general-purpose port p pins. the pwm function is enabled with the pwen register. enabling pwm pins takes precedence over the general-purpose port. when pulse-width modulation is not in use, the port pins may be used for general-purpose i/o. register ddrp determines pin direction of port p when used for general-purpose i/o. when ddrp bits are set, the corresponding pin is configured for output. on reset the ddrp bits are cleared and the corresponding pin is configured for input. 20-pins
pinout and signal descriptions port signals mc68hc912dt128a rev 2.0 motorola pinout and signal descriptions 47 21-pins when the pupp bit in the pwctl register is set, all input pins are pulled up internally by an active pull-up device. pullups are disabled after reset. setting the rdpp bit in the pwctl register configures all port p outputs to have reduced drive levels. levels are at normal drive capability after reset. the pwctl register can be read or written anytime after reset. refer to pulse-width modulator . port s port s is the 8-bit interface to the standard serial interface consisting of the two serial communications interfaces (sci1 and sci0) and the serial peripheral interface (spi) subsystems. port s pins are available for general-purpose i/o when standard serial functions are not enabled. port s pins serve several functions depending on the various internal control registers. if woms bit in the sc0cr1register is set, the p-channel drivers of the output buffers are disabled (wire-or mode) for pins 0 through 3. if swom bit in the sp0cr1 register is set, the p-channel drivers of the output buffers are disabled (wire-or mode) for pins 4 through 7. the open drain control affects both the serial and the general-purpose outputs. if the rdps bit in the sp0cr2 register is set, port s pin drive capabilities are reduced. if pups bit in the sp0cr2 register is set, a pull-up device is activated for each port s pin programmed as a general purpose input. if the pin is programmed as a general-purpose output, the pull-up is disconnected from the pin regardless of the state of pups bit. see multiple serial interface . port t this port provides eight general-purpose i/o pins when not enabled for input capture and output compare in the timer and pulse accumulator subsystem. the ten bit in the tscr register enables the timer function. the pulse accumulator subsystem is enabled with the paen bit in the pactl register. register ddrt determines pin direction of port t when used for general-purpose i/o. when ddrt bits are set, the corresponding pin is configured for output. on reset the ddrt bits are cleared and the corresponding pin is configured for input.
pinout and signal descriptions mc68hc912dt128a rev 2.0 48 pinout and signal descriptions motorola when the pupt bit in the tmsk2 register is set, all input pins are pulled up internally by an active pull-up device. pullups are disabled after reset. setting the rdpt bit in the tmsk2 register configures all port t outputs to have reduced drive levels. levels are at normal drive capability after reset. the tmsk2 register can be read or written anytime after reset. refer to enhanced capture timer . table 7 mc68hc912dt128a port description summary port name pin numbers data direction register (address) description 112-pin port a pa[7:0] 64-57 in/out ddra ($0002) port a and port b pins are used for address and data in expanded modes. the port data registers are not in the address map during expanded and peripheral mode operation. when in the map, port a and port b can be read or written any time. ddra and ddrb are not in the address map in expanded or peripheral modes. port b pb[7:0] 31 ? 24 in/out ddrb ($0003) port ad1 pad1[7:0] 84/82/80/ 78/76/74/ 72/70 in analog-to-digital converter 1 and general-purpose i/o. port ad0 pad0[7:0] 83/81/79/ 77/75/73/ 71/69 in analog-to-digital converter 0 and general-purpose i/o. port can2 pcan2[1:0] (1) 100 ? 101 pcan2[1] out pcan2[0] in pcan2[1:0] are used with the mscan2 module and cannot be used as general purpose i/o (mc68hc912dt128a only). port can1 pcan1[1:0] 102 ? 103 pcan1[1] out pcan1[0] in pcan1[1:0] are used with the mscan1 module and cannot be used as general purpose i/o. port can0 pcan0[1:0] 104 ? 105 pcan0[1] out pcan0[0] in pcan0[1:0] are used with the mscan0 module and cannot be used as general purpose i/o. port ib pib[7:6] 98 ? 99 in/out ddrib ($00e7) general purpose i/o. pib[7:6] are used with the i-bus module when enabled. port ib pib[5:4] (2) 100 ? 101 in/out ddrib ($00e7) general purpose i/o (mc68hc912dg128a only). port e pe[7:0] 36 ? 39, 53 ? 56 pe[1:0] in pe[7:2] in/out ddre ($0009) mode selection, bus control signals and interrupt service request signals; or general-purpose i/o. port k pk[7,3:0] 13, 108-111 in/out ddrk ($00fd) page index emulation signals in expanded or peripheral mode or general-purpose i/o. 22-pins
pinout and signal descriptions port signals mc68hc912dt128a rev 2.0 motorola pinout and signal descriptions 49 23-pins port pull-up pull-down and reduced drive mcu ports can be configured for internal pull-up. to reduce power consumption and rfi, the pin output drivers can be configured to operate at a reduced drive level. reduced drive causes a slight increase in transition time depending on loading and should be used only for ports which have a light loading. table 1 summarizes the port pull-up default status and controls. port p pp[3:0] 112, 1 ? 3 in/out ddrp ($0057) general-purpose i/o. pp[3:0] are used with the pulse-width modulator when enabled. port s ps[7:0] 96 ? 89 in/out ddrs ($00d7) serial communications interfaces 1 and 0 and serial peripheral interface subsystems; or general-purpose i/o. port t pt[7:0] 18 ? 15, 7 ? 4 in/out ddrt ($00af) general-purpose i/o when not enabled for input capture and output compare in the timer and pulse accumulator subsystem. 1 mc68hc912dt128a only 2 mc68hc912dg128a only table 7 mc68hc912dt128a port description summary port name pin numbers data direction register (address) description 112-pin table 1 port pull-up, pull-down and reduced drive summary enable bit reduced drive control bit port name resistive input loads register (address) bit name reset state register (address) bit name reset state port a pull-up pucr ($000c) pupa disabled rdriv ($000d) rdpa full drive port b pull-up pucr ($000c) pupb disabled rdriv ($000d) rdpb full drive port e: pe7, pe[3:2] pull-up pucr ($000c) pupe enabled rdriv ($000d) rdpe full drive pe[1:0] pull-up pucr ($000c) pupe enabled ? pe[6:4] none ? rdriv ($000d) rdpe full drive port h pull-up or pull-down pucr ($000c) puph disabled rdriv ($000d) rdph full drive port j pull-up or pull-down pucr ($000c) pupj disabled rdriv ($000d) rdpj full drive port k pull-up pucr ($000c) pupk disabled rdriv ($000d) rdpk full drive port p pull-up pwctl ($0054) pupp disabled pwctl ($0054) rdpp full drive port s pull-up sp0cr2 ($00d1) pups enabled sp0cr2 ($00d1) rdps full drive port t pull-up tmsk2 ($008d) tpu disabled tmsk2 ($008d) tdrb full drive
pinout and signal descriptions mc68hc912dt128a rev 2.0 50 pinout and signal descriptions motorola port ib[7:6] pull-up ibpurd ($00e5) pupib disabled ibpurd ($00e5) rdpib full drive port ib[5:4] (1) pull-up ibpurd ($00e5) pupib disabled ibpurd ($00e5) rdpib full drive port ad0 none ?? port ad1 none ?? port can2[1] (2) none ?? port can2[0] (2) pull-up always enabled ? port can1[1] none ?? port can1[0] pull-up always enabled ? port can0[1] none ?? port can0[0] pull-up always enabled ? 1 mc68hc912dg128a only 2 mc68hc912dt128a only table 1 port pull-up, pull-down and reduced drive summary enable bit reduced drive control bit port name resistive input loads register (address) bit name reset state register (address) bit name reset state 24-pins
mc68hc912dt128a rev 2.0 motorola registers 51 registers registers contents register block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 register block the register block can be mapped to any 2k byte boundary within the standard 64k byte address space by manipulating bits reg[15:11] in the initrg register. initrg establishes the upper five bits of the register block ? s 16-bit address. the register block occupies the first 1k byte of the 2k byte block. default addressing (after reset) is indicated in the table below. for additional information refer to operating modes . table 8 mc68hc912dt128a register map (sheet 1 of 11) addressbit 7654321bit 0name $0000 pa7 pa6 pa5 pa4 pa3 pa2 pa1 pa0 porta (1) $0001 pb7 pb6 pb5 pb4 pb3 pb2 pb1 pb0 portb (1) $0002 dda7 dda6 dda5 dda4 dda3 dda2 dda1 dda0 ddra (1) $0003 ddb7 ddb6 ddb5 ddb4 ddb3 ddb2 ddb1 ddb0 ddrb (1) $0004-$ 0007 00000000reserved (3) $0008 pe7 pe6 pe5 pe4 pe3 pe2 pe1 pe0 porte (2) $0009 dde7 dde6 dde5 dde4 dde3 dde2 0 0 ddre (2) $000a ndbe cgmte pipoe neclk lstre rdwe cale dbene pear (3) $000b smodn modb moda estr ivis ebswai emk eme mode (3) $000c pupk pupj puph pupe 0 0 pupb pupa pucr (3) $000d rdpk rdpj rdph rdpe 0 0 rdpb rdpa rdriv (3) $000e00000000reserved (3) $000f00000000reserved (3) $0010 ram15 ram14 ram13 0 0 0 0 0 initrm $0011 reg15 reg14 reg13 reg12 reg11 0 0 mmswai initrg 1-reg
registers mc68hc912dt128a rev 2.0 52 registers motorola $0012 ee15 ee14 ee13 ee12 0 0 0 eeon initee $0013 romtst ndrf rfstr1 rfstr0 exstr1 exstr0 romhm romon misc $0014 rtie rswai rsbck reserved rtbyp rtr2 rtr1 rtr0 rtictl $0015 rtif 0 0 0 0 0 0 0 rtiflg $0016 cme fcme fcmcop wcop disr cr2 cr1 cr0 copctl $0017 bit 7 6 5 4 3 2 1 bit 0 coprst $0018 ite6 ite8 itea itec itee itf0 itf2 itf4 itst0 $0019 itd6 itd8 itda itdc itde ite0 ite2 ite4 itst1 $001a itc6 itc8 itca itcc itce itd0 itd2 itd4 itst2 $001b itb6 itb8 itba itbc itbe itc0 itc2 itc4 itst3 $001c ita6 ita8 itaa itac itae itb0 itb2 itb4 itst4 $001d00000000reserved $001e irqe irqen dly 0 0 0 0 0 intcr $001f 1 psel6 psel5 psel4 psel3 psel2 psel1 0 hprio $0020 bken1 bken0 bkpm 0 bk1ale bk0ale 0 0 brkct0 $0021 0 bkdbe bkmbh bkmbl bk1rwe bk1rw bk0rwe bk0rw brkct1 $0022 bit 15 14 13 12 11 10 9 bit 8 brkah $0023 bit 7 6 5 4 3 2 1 bit 0 brkal $0024 bit 15 14 13 12 11 10 9 bit 8 brkdh $0025 bit 7 6 5 4 3 2 1 bit 0 brkdl $0026 00000000reserved $0027 00000000reserved $0028 pj7 pj6 pj5 pj4 pj3 pj2 pj1 pj0 portj $0029 ph7 ph6 ph5 ph4 ph3 ph2 ph1 ph0 porth $002a ddj7 ddj6 ddj5 ddj4 ddj3 ddj2 ddj1 ddj0 ddrj $002b ddh7 ddh6 ddh5 ddh4 ddh3 ddh2 ddh1 ddh0 ddrh $002c kwiej7kwiej6kwiej5kwiej4kwiej3kwiej2kwiej1kwiej0 kwiej $002d kwieh7 kwieh6 kwieh5 kwieh4 kwieh3 kwieh2 kwieh1 kwieh0 kwieh $002e kwifj7 kwifj6 kwifj5 kwifj4 kwifj3 kwifj2 kwifj1 kwifj0 kwifj $002f kwifh7 kwifh6 kwifh5 kwifh4 kwifh3 kwifh2 kwifh1 kwifh0 kwifh $0030 kwpj7 kwpj6 kwpj5 kwpj4 kwpj3 kwpj2 kwpj1 kwpj0 kwpj $0031 kwph7 kwph6 kwph5 kwph4 kwph3 kwph2 kwph1 kwph0 kwph $0032 00000000reserved $0033 00000000reserved $0034 ? $0037 unimplemented (4) reserved $0038 0 0 syn5 syn4 syn3 syn2 syn1 syn0 synr $0039 00000refdv2refdv1refdv0refdv $003a tstout7 tstout6 tstout5 tstout4 tstout3 tstout2 tstout1 tstout0 cgtflg $003b lockif lock 0 0 0 0 lhif lhome pllflg $003c lockie pllon auto acq 0 pstp lhie nolhm pllcr table 8 mc68hc912dt128a register map (sheet 2 of 11) address bit 7 6 5 4 3 2 1 bit 0 name 2--reg
registers register block mc68hc912dt128a rev 2.0 motorola registers 53 $003d 0 bcsp bcss 0 0 mcs 0 0 clksel $003e 0 0 sldv5 sldv4 sldv3 sldv2 sldv1 sldv0 slow $003f opnle trk tstclketst4tst3tst2tst1tst0cgtctl $0040 con23 con01 pcka2 pcka1 pcka0 pckb2 pckb1 pckb0 pwclk $0041 pclk3 pclk2 pclk1 pclk0 ppol3 ppol2 ppol1 ppol0 pwpol $0042 0000pwen3pwen2pwen1pwen0pwen $0043 0 bit 6 5 4 3 2 1 bit 0 pwpres $0044 bit 7 6 5 4 3 2 1 bit 0 pwscal0 $0045 bit 7 6 5 4 3 2 1 bit 0 pwscnt0 $0046 bit 7 6 5 4 3 2 1 bit 0 pwscal1 $0047 bit 7 6 5 4 3 2 1 bit 0 pwscnt1 $0048 bit 7 6 5 4 3 2 1 bit 0 pwcnt0 $0049 bit 7 6 5 4 3 2 1 bit 0 pwcnt1 $004abit 7654321bit 0pwcnt2 $004bbit 7654321bit 0pwcnt3 $004cbit 7654321bit 0pwper0 $004dbit 7654321bit 0pwper1 $004ebit 7654321bit 0pwper2 $004fbit 7654321bit 0pwper3 $0050 bit 7 6 5 4 3 2 1 bit 0 pwdty0 $0051 bit 7 6 5 4 3 2 1 bit 0 pwdty1 $0052 bit 7 6 5 4 3 2 1 bit 0 pwdty2 $0053 bit 7 6 5 4 3 2 1 bit 0 pwdty3 $0054 0 0 0 pswai centr rdpp pupp psbck pwctl $0055 discr discp discal 0 0 0 0 0 pwtst $0056 pp7 pp6 pp5 pp4 pp3 pp2 pp1 pp0 portp $0057 ddp7 ddp6 ddp5 ddp4 ddp3 ddp2 ddp1 ddp0 ddrp $0058-$ 005f 00000000reserved $0060 reserved atd0ctl0 $0061 reserved atd0ctl1 $0062 adpu affc aswai djm dsgn reserved ascie ascif atd0ctl2 $0063 0000s1cfifofrz1frz0atd0ctl3 $0064 res10 smp1 smp0 prs4 prs3 prs2 prs1 prs0 atd0ctl4 $0065 0 s8c scan mult cd cc cb ca atd0ctl5 $0066 scf 0 0 0 0 cc2 cc1 cc0 atd0stat0 $0067 ccf7 ccf6 ccf5 ccf4 ccf3 ccf2 ccf1 ccf0 atd0stat1 $0068 sar9 sar8 sar7 sar6 sar5 sar4 sar3 sar2 atd0testh $0069 sar1 sar0 rst tstout tst3 tst2 tst1 tst0 atd0testl $006a ? $ 006e 00000000reserved table 8 mc68hc912dt128a register map (sheet 3 of 11) address bit 7 6 5 4 3 2 1 bit 0 name 3-reg
registers mc68hc912dt128a rev 2.0 54 registers motorola $006f pad07 pad06 pad05 pad04 pad03 pad02 pad01 pad00 portad0 $0070 bit 15 14 13 12 11 10 9 bit 8 adr00h $0071 bit 7 bit 6 0 0 0 0 0 0 adr00l $0072 bit 15 14 13 12 11 10 9 bit 8 adr01h $0073 bit 7 bit 6 0 0 0 0 0 0 adr01l $0074 bit 15 14 13 12 11 10 9 bit 8 adr02h $0075 bit 7 bit 6 0 0 0 0 0 0 adr02l $0076 bit 15 14 13 12 11 10 9 bit 8 adr03h $0077 bit 7 bit 6 0 0 0 0 0 0 adr03l $0078 bit 15 14 13 12 11 10 9 bit 8 adr04h $0079 bit 7 bit 6 0 0 0 0 0 0 adr04l $007a bit 15 14 13 12 11 10 9 bit 8 adr05h $007b bit 7 bit 6 0 0 0 0 0 0 adr05l $007c bit 15 14 13 12 11 10 9 bit 8 adr06h $007d bit 7 bit 6 0 0 0 0 0 0 adr06l $007e bit 15 14 13 12 11 10 9 bit 8 adr07h $007f bit 7 bit 6 0 0 0 0 0 0 adr07l $0080 ios7 ios6 ios5 ios4 ios3 ios2 ios1 ios0 tios $0081 foc7 foc6 foc5 foc4 foc3 foc2 foc1 foc0 cforc $0082 oc7m7 oc7m6 oc7m5 oc7m4 oc7m3 oc7m2 oc7m1 oc7m0 oc7m $0083 oc7d7 oc7d6 oc7d5 oc7d4 oc7d3 oc7d2 oc7d1 oc7d0 oc7d $0084 bit 15 14 13 12 11 10 9 bit 8 tcnt $0085 bit 7 6 5 4 3 2 1 bit 0 tcnt $0086 ten tswai tsbck tffca reserved tscr $0087 reserved tqcr $0088 om7 ol7 om6 ol6 om5 ol5 om4 ol4 tctl1 $0089 om3 ol3 om2 ol2 om1 ol1 om0 ol0 tctl2 $008a edg7b edg7a edg6b edg6a edg5b edg5a edg4b edg4a tctl3 $008b edg3b edg3a edg2b edg2a edg1b edg1a edg0b edg0a tctl4 $008c c7i c6i c5i c4i c3i c2i c1i c0i tmsk1 $008d toi 0 pupt rdpt tcre pr2 pr1 pr0 tmsk2 $008e c7f c6f c5f c4f c3f c2f c1f c0f tflg1 $008ftof0000000tflg2 $0090 bit 15 14 13 12 11 10 9 bit 8 tc0 $0091 bit 7 6 5 4 3 2 1 bit 0 tc0 $0092 bit 15 14 13 12 11 10 9 bit 8 tc1 $0093 bit 7 6 5 4 3 2 1 bit 0 tc1 $0094 bit 15 14 13 12 11 10 9 bit 8 tc2 $0095 bit 7 6 5 4 3 2 1 bit 0 tc2 $0096 bit 15 14 13 12 11 10 9 bit 8 tc3 $0097 bit 7 6 5 4 3 2 1 bit 0 tc3 table 8 mc68hc912dt128a register map (sheet 4 of 11) address bit 7 6 5 4 3 2 1 bit 0 name 4-reg
registers register block mc68hc912dt128a rev 2.0 motorola registers 55 $0098 bit 15 14 13 12 11 10 9 bit 8 tc4 $0099 bit 7 6 5 4 3 2 1 bit 0 tc4 $009a bit 15 14 13 12 11 10 9 bit 8 tc5 $009bbit 7654321bit 0tc5 $009c bit 15 14 13 12 11 10 9 bit 8 tc6 $009dbit 7654321bit 0tc6 $009e bit 15 14 13 12 11 10 9 bit 8 tc7 $009fbit 7654321bit 0tc7 $00a0 0 paen pamod pedge clk1 clk0 paovi pai pactl $00a1000000paovfpaifpaflg $00a2bit 7654321bit 0pacn3 $00a3bit 7654321bit 0pacn2 $00a4bit 7654321bit 0pacn1 $00a5bit 7654321bit 0pacn0 $00a6 mczi modmc rdmcl iclat flmc mcen mcpr1 mcpr0 mcctl $00a7 mczf 0 0 0 polf3 polf2 polf1 polf0 mcflg $00a80000pa3enpa2enpa1enpa0enicpar $00a9000000dly1dly0dlyct $00aa novw7 novw6 novw5 novw4 novw3 novw2 novw1 novw0 icovw $00ab sh37 sh26 sh15 sh04 tfmod pacmx bufen latq icsys $00ac00000000reserved $00ad000000tcbyp0timtst $00ae pt7 pt6 pt5 pt4 pt3 pt2 pt1 pt0 portt $00af ddt7 ddt6 ddt5 ddt4 ddt3 ddt2 ddt1 ddt0 ddrt $00b0 0 pben 0 0 0 0 pbovi 0 pbctl $00b1000000pbovf0pbflg $00b2bit 7654321bit 0pa3h $00b3bit 7654321bit 0pa2h $00b4bit 7654321bit 0pa1h $00b5bit 7654321bit 0pa0h $00b6 bit 15 14 13 12 11 10 9 bit 8 mccnth $00b7 bit 7 6 5 4 3 2 1 bit 0 mccntl $00b8 bit 15 14 13 12 11 10 9 bit 8 tc0h $00b9bit 7654321bit 0tc0h $00ba bit 15 14 13 12 11 10 9 bit 8 tc1h $00bbbit 7654321bit 0tc1h $00bc bit 15 14 13 12 11 10 9 bit 8 tc2h $00bdbit 7654321bit 0tc2h $00be bit 15 14 13 12 11 10 9 bit 8 tc3h $00bfbit 7654321bit 0tc3h $00c0 btst bspl brld sbr12 sbr11 sbr10 sbr9 sbr8 sc0bdh table 8 mc68hc912dt128a register map (sheet 5 of 11) address bit 7 6 5 4 3 2 1 bit 0 name 5-reg
registers mc68hc912dt128a rev 2.0 56 registers motorola $00c1 sbr7 sbr6 sbr5 sbr4 sbr3 sbr2 sbr1 sbr0 sc0bdl $00c2 loops woms rsrc m wake ilt pe pt sc0cr1 $00c3 tie tcie rie ilie te re rwu sbk sc0cr2 $00c4 tdre tc rdrf idle or nf fe pf sc0sr1 $00c50000000rafsc0sr2 $00c6 r8 t8 0 0 0 0 0 0 sc0drh $00c7 r7/t7 r6/t6 r5/t5 r4/t4 r3/t3 r2/t2 r1/t1 r0/t0 sc0drl $00c8 btst bspl brld sbr12 sbr11 sbr10 sbr9 sbr8 sc1bdh $00c9 sbr7 sbr6 sbr5 sbr4 sbr3 sbr2 sbr1 sbr0 sc1bdl $00ca loops woms rsrc m wake ilt pe pt sc1cr1 $00cb tie tcie rie ilie te re rwu sbk sc1cr2 $00cc tdre tc rdrf idle or nf fe pf sc1sr1 $00cd0000000rafsc1sr2 $00ce r8 t8 0 0 0 0 0 0 sc1drh $00cf r7/t7 r6/t6 r5/t5 r4/t4 r3/t3 r2/t2 r1/t1 r0/t0 sc1drl $00d0 spie spe swom mstr cpol cpha ssoe lsbf sp0cr1 $00d10000pupsrdpssswaispc0sp0cr2 $00d200000spr2spr1spr0sp0br $00d3 spif wcol 0 modf 0 0 0 0 sp0sr $00d4 0 0 0 0 0 0 0 0 reserved $00d5bit 7654321bit 0sp0dr $00d6 ps7 ps6 ps5 ps4 ps3 ps2 ps1 ps0 ports $00d7 dds7 dds6 dds5 dds4 dds3 dds2 dds1 dds0 ddrs $00d8 ? $ 00df 0 0 0 0 0 0 0 0 reserved $00e0 adr7 adr6 adr5 adr4 adr3 adr2 adr1 0 ibad $00e1 0 0 ibc5 ibc4 ibc3 ibc2 ibc1 ibc0 ibfd $00e2 iben ibie ms/sl tx/rx txak rsta 0 ibswai ibcr $00e3 tcf iaas ibb ibal 0 srw ibif rxak ibsr $00e4 d7 d6 d5 d4 d3 d2 d1 d0 ibdr $00e5000rdpib000pupibibpurd $00e6 pib7 pib6 pib5 pib4 pib3 pib2 pib1 pib0 portib $00e7 ddrib7 ddrib6 ddrib5 ddrib4 ddrib3 ddrib2 ddrib1 ddrib0 ddrib $00e8 ? $00eb unimplemented (4) reserved $00ec ? $ 00ed 0 0 0 0 0 0 0 0 reserved $00ee000000eediv9eediv8eedivh $00ef eediv7 eediv6 eediv5 eediv4 eediv3 eediv2 eediv1 eediv0 eedivl $00f0 nobdml noshw reserved 1 eeswai protlck eerc eemcr $00f1 shprot 1 bprot5 bprot4 bprot3 bprot2 bprot1 bprot0 eeprot table 8 mc68hc912dt128a register map (sheet 6 of 11) address bit 7 6 5 4 3 2 1 bit 0 name 6-reg
registers register block mc68hc912dt128a rev 2.0 motorola registers 57 7-reg $00f2 0 erevtn 0 0 0 etmsd etmr etmse eetst $00f3 bulkp 0 auto byte row erase eelat eepgm eeprog $00f40000000lockfeelck $00f50000000bootpfeemcr $00f6 stre revtun 0 0 0 tmsd tmr tmse feetst $00f7 0 0 0 feeswai hven 0 eras pgm feectl $00f8 mt07 mt06 mt05 mt04 mt03 mt02 mt01 mt00 mtst0 $00f9 mt0f mt0e mt0d mt0c mt0b mt0a mt09 mt08 mtst1 $00fa mt17 mt16 mt15 mt14 mt13 mt12 mt11 mt10 mtst2 $00fb mt1f mt1e mt1d mt1c mt1b mt1a mt19 mt18 mtst3 $00fc pk7 0 0 0 pk3 pk2 pk1 pk0 portk (5) $00fd ddk7 0 0 0 ddk3 ddk2 ddk1 ddk0 ddrk (5) $00fe00000000reserved $00ff00000pix2pix1pix0ppage $0100 0 0 cswai synch tlnken slpak slprq sftres c0mcr0 $0101 00000loopbwupmclksrcc0mcr1 $0102 sjw1 sjw0 brp5 brp4 brp3 brp2 brp1 brp0 c0btr0 $0103 samp tseg22 tseg21 tseg20 tseg13 tseg12 tseg11 tseg10 c0btr1 $0104 wupif rwrnif twrnif rerrif terrif boffif ovrif rxf c0rflg $0105 wupie rwrnie twrnie rerrie terrie boffie ovrie rxfie c0rier $0106 0 abtak2 abtak1 abtak0 0 txe2 txe1 txe0 c0tflg $0107 0 abtrq2 abtrq1 abtrq0 0 txeie2 txeie1 txeie0 c0tcr $0108 0 0 idam1 idam0 0 idhit2 idhit1 idhit0 c0idac $0109 ? $010d unimplemented (4) reserved $010e rxerr7 rxerr6 rxerr5 rxerr4 rxerr3 rxerr2 rxerr1 rxerr0 c0rxerr $010f txerr7 txerr6 txerr5 txerr4 txerr3 txerr2 txerr1 txerr0 c0txerr $0110 ac7 ac6 ac5 ac4 ac3 ac2 ac1 ac0 c0idar0 $0111ac7ac6ac5ac4ac3ac2ac1ac0c0idar1 $0112 ac7 ac6 ac5 ac4 ac3 ac2 ac1 ac0 c0idar2 $0113 ac7 ac6 ac5 ac4 ac3 ac2 ac1 ac0 c0idar3 $0114 am7 am6 am5 am4 am3 am2 am1 am0 c0idmr0 $0115 am7 am6 am5 am4 am3 am2 am1 am0 c0idmr1 $0116 am7 am6 am5 am4 am3 am2 am1 am0 c0idmr2 $0117 am7 am6 am5 am4 am3 am2 am1 am0 c0idmr3 $0118 ac7 ac6 ac5 ac4 ac3 ac2 ac1 ac0 c0idar4 $0119 ac7 ac6 ac5 ac4 ac3 ac2 ac1 ac0 c0idar5 $011aac7ac6ac5ac4ac3ac2ac1ac0c0idar6 $011bac7ac6ac5ac4ac3ac2ac1ac0c0idar7 $011c am7 am6 am5 am4 am3 am2 am1 am0 c0idmr4 $011d am7 am6 am5 am4 am3 am2 am1 am0 c0idmr5 table 8 mc68hc912dt128a register map (sheet 7 of 11) address bit 7 6 5 4 3 2 1 bit 0 name
registers mc68hc912dt128a rev 2.0 58 registers motorola $011eam7am6am5am4am3am2am1am0c0idmr6 $011f am7 am6 am5 am4 am3 am2 am1 am0 c0idmr7 $0120 ? $013c unimplemented (4) reserved $013d000000pupcanrdpcanpctlcan0 $013e pcan7 pcan6 pcan5 pcan4 pcan3 pcan2 txcan rxcan portcan0 $013f ddcan7 ddcan6 ddcan5 ddcan4 ddcan3 ddcan2 0 0 ddrcan0 $0140 ? $014f foreground receive buffer 0 rxfg0 $0150 ? $015f transmit buffer 00 tx00 $0160 ? $016f transmit buffer 01 tx01 $0170 ? $017f transmit buffer 02 tx02 $0180 ? $01df unimplemented (4) reserved $01e0 reserved atd1ctl0 $01e1 reserved atd1ctl1 $01e2 adpu affc aswai djm dsgn reserved ascie ascif atd1ctl2 $01e30000s1cfifofrz1frz0atd1ctl3 $01e4 res10 smp1 smp0 prs4 prs3 prs2 prs1 prs0 atd1ctl4 $01e5 0 s8c scan mult cd cc cb ca atd1ctl5 $01e6 scf 0 0 0 0 cc2 cc1 cc0 atd1stat0 $01e7 ccf7 ccf6 ccf5 ccf4 ccf3 ccf2 ccf1 ccf0 atd1stat1 $01e8 sar9 sar8 sar7 sar6 sar5 sar4 sar3 sar2 atd1testh $01e9 sar1 sar0 rst tstout tst3 tst2 tst1 tst0 atd1testl $01ea ? $ 01ee 0 0 0 0 0 0 0 0 reserved $01ef pad17 pad16 pad15 pad14 pad13 pad12 pad11 pad10 portad1 $01f0 bit 15 14 13 12 11 10 9 bit 8 adr10h $01f1 bit 7 bit 6 0 0 0 0 0 0 adr10l $01f2 bit 15 14 13 12 11 10 9 bit 8 adr11h $01f3 bit 7 bit 6 0 0 0 0 0 0 adr11l $01f4 bit 15 14 13 12 11 10 9 bit 8 adr12h $01f5 bit 7 bit 6 0 0 0 0 0 0 adr12l $01f6 bit 15 14 13 12 11 10 9 bit 8 adr13h $01f7 bit 7 bit 6 0 0 0 0 0 0 adr13l $01f8 bit 15 14 13 12 11 10 9 bit 8 adr14h $01f9 bit 7 bit 6 0 0 0 0 0 0 adr14l $01fa bit 15 14 13 12 11 10 9 bit 8 adr15h $01fb bit 7 bit 6 0 0 0 0 0 0 adr15l table 8 mc68hc912dt128a register map (sheet 8 of 11) address bit 7 6 5 4 3 2 1 bit 0 name 8-reg
registers register block mc68hc912dt128a rev 2.0 motorola registers 59 9-reg $01fc bit 15 14 13 12 11 10 9 bit 8 adr16h $01fd bit 7 bit 6 0 0 0 0 0 0 adr16l $01fe bit 15 14 13 12 11 10 9 bit 8 adr17h $01ff bit 7 bit 6 0 0 0 0 0 0 adr17l (6) $0200 0 0 cswai synch tlnken slpak slprq sftres c2mcr0 (6) $020100000loopbwupmclksrcc2mcr1 (6) $0202 sjw1 sjw0 brp5 brp4 brp3 brp2 brp1 brp0 c2btr0 (6) $0203 samp tseg22 tseg21 tseg20 tseg13 tseg12 tseg11 tseg10 c2btr1 (6) $0204 wupif rwrnif twrnif rerrif terrif boffif ovrif rxf c2rflg (6) $0205 wupie rwrnie twrnie rerrie terrie boffie ovrie rxfie c2rier (6) $0206 0 abtak2 abtak1 abtak0 0 txe2 txe1 txe0 c2tflg (6) $0207 0 abtrq2 abtrq1 abtrq0 0 txeie2 txeie1 txeie0 c2tcr (6) $0208 0 0 idam1 idam0 0 idhit2 idhit1 idhit0 c2idac $0209 ? $020d unimplemented (4) reserved (6) $020e rxerr7 rxerr6 rxerr5 rxerr4 rxerr3 rxerr2 rxerr1 rxerr0 c2rxerr (6) $020f txerr7 txerr6 txerr5 txerr4 txerr3 txerr2 txerr1 txerr0 c2txerr (6) $0210ac7ac6ac5ac4ac3ac2ac1ac0c2idar0 (6) $0211 ac7 ac6 ac5 ac4 ac3 ac2 ac1 ac0 c2idar1 (6) $0212ac7ac6ac5ac4ac3ac2ac1ac0c2idar2 (6) $0213ac7ac6ac5ac4ac3ac2ac1ac0c2idar3 (6) $0214am7am6am5am4am3am2am1am0c2idmr0 (6) $0215am7am6am5am4am3am2am1am0c2idmr1 (6) $0216am7am6am5am4am3am2am1am0c2idmr2 (6) $0217am7am6am5am4am3am2am1am0c2idmr3 (6) $0218ac7ac6ac5ac4ac3ac2ac1ac0c2idar4 (6) $0219ac7ac6ac5ac4ac3ac2ac1ac0c2idar5 (6) $021a ac7 ac6 ac5 ac4 ac3 ac2 ac1 ac0 c2idar6 (6) $021b ac7 ac6 ac5 ac4 ac3 ac2 ac1 ac0 c2idar7 (6) $021cam7am6am5am4am3am2am1am0c2idmr4 (6) $021dam7am6am5am4am3am2am1am0c2idmr5 (6) $021e am7 am6 am5 am4 am3 am2 am1 am0 c2idmr6 (6) $021fam7am6am5am4am3am2am1am0c2idmr7 $0220 ? $023c unimplemented (4) reserved (6) $023d000000pupcanrdpcanpctlcan2 (6) $023e pcan7 pcan6 pcan5 pcan4 pcan3 pcan2 txcan rxcan portcan2 (6) $023f ddcan7 ddcan6 ddcan5 ddcan4 ddcan3 ddcan2 0 0 ddrcan2 (6) $0240 ? $024f foreground receive buffer 2 rxfg2 (6) $0250 ? $025f transmit buffer 20 tx20 table 8 mc68hc912dt128a register map (sheet 9 of 11) address bit 7 6 5 4 3 2 1 bit 0 name
registers mc68hc912dt128a rev 2.0 60 registers motorola (6) $0260 ? $026f transmit buffer 21 tx21 (6) $0270 ? $027f transmit buffer 22 tx22 $0280- $02ff unimplemented (4) reserved $0300 0 0 cswai synch tlnken slpak slprq sftres c1mcr0 $0301 00000loopbwupmclksrcc1mcr1 $0302 sjw1 sjw0 brp5 brp4 brp3 brp2 brp1 brp0 c1btr0 $0303 samp tseg22 tseg21 tseg20 tseg13 tseg12 tseg11 tseg10 c1btr1 $0304 wupif rwrnif twrnif rerrif terrif boffif ovrif rxf c1rflg $0305 wupie rwrnie twrnie rerrie terrie boffie ovrie rxfie c1rier $0306 0 abtak2 abtak1 abtak0 0 txe2 txe1 txe0 c1tflg $0307 0 abtrq2 abtrq1 abtrq0 0 txeie2 txeie1 txeie0 c1tcr $0308 0 0 idam1 idam0 0 idhit2 idhit1 idhit0 c1idac $0309 ? $030d unimplemented (4) reserved $030e rxerr7 rxerr6 rxerr5 rxerr4 rxerr3 rxerr2 rxerr1 rxerr0 c1rxerr $030f txerr7 txerr6 txerr5 txerr4 txerr3 txerr2 txerr1 txerr0 c1txerr $0310 ac7 ac6 ac5 ac4 ac3 ac2 ac1 ac0 c1idar0 $0311 ac7 ac6 ac5 ac4 ac3 ac2 ac1 ac0 c1idar1 $0312 ac7 ac6 ac5 ac4 ac3 ac2 ac1 ac0 c1idar2 $0313 ac7 ac6 ac5 ac4 ac3 ac2 ac1 ac0 c1idar3 $0314 am7 am6 am5 am4 am3 am2 am1 am0 c1idmr0 $0315 am7 am6 am5 am4 am3 am2 am1 am0 c1idmr1 $0316 am7 am6 am5 am4 am3 am2 am1 am0 c1idmr2 $0317 am7 am6 am5 am4 am3 am2 am1 am0 c1idmr3 $0318 ac7 ac6 ac5 ac4 ac3 ac2 ac1 ac0 c1idar4 $0319 ac7 ac6 ac5 ac4 ac3 ac2 ac1 ac0 c1idar5 $031aac7ac6ac5ac4ac3ac2ac1ac0c1idar6 $031bac7ac6ac5ac4ac3ac2ac1ac0c1idar7 $031c am7 am6 am5 am4 am3 am2 am1 am0 c1idmr4 $031d am7 am6 am5 am4 am3 am2 am1 am0 c1idmr5 $031eam7am6am5am4am3am2am1am0c1idmr6 $031fam7am6am5am4am3am2am1am0c1idmr7 $0320 ? $033c unimplemented (4) reserved $033d000000pupcanrdpcanpctlcan1 $033e pcan7 pcan6 pcan5 pcan4 pcan3 pcan2 txcan rxcan portcan1 $033f ddcan7 ddcan6 ddcan5 ddcan4 ddcan3 ddcan2 0 0 ddrcan1 $0340 ? $034f foreground receive buffer 1 rxfg1 table 8 mc68hc912dt128a register map (sheet 10 of 11) address bit 7 6 5 4 3 2 1 bit 0 name 10-reg
registers register block mc68hc912dt128a rev 2.0 motorola registers 61 11-reg $0350 ? $035f transmit buffer 10 tx10 $0360 ? $036f transmit buffer 11 tx11 $0370 ? $037f transmit buffer 12 tx12 $0380-$ 03ff unimplemented (4) reserved = reserved or unimplemented bits. 1. port a, port b and data direction registers ddra, ddrb are not in map in expanded and peripheral modes. 2. port e and ddre not in the map in peripheral and expanded modes with eme set. 3. registers also not in map in peripheral mode. 4. data read at these locations is undefined. 5. port k and ddrk not in the map in peripheral and expanded modes with emk set. 6. mc68hc912dt128a only. locations are unimplemented on the mc68hc912dg128a. table 8 mc68hc912dt128a register map (sheet 11 of 11) address bit 7 6 5 4 3 2 1 bit 0 name
registers mc68hc912dt128a rev 2.0 62 registers motorola 12-reg
mc68hc912dt128a rev 2.0 motorola operating modes 63 operating modes operating modes contents introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 operating modes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 background debug mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 introduction eight possible operating modes determine the operating configuration of the mc68hc912dt128a. each mode has an associated default memory map and external bus configuration. operating modes the operating mode out of reset is determined by the states of the bkgd, modb, and moda pins during reset. the smodn, modb, and moda bits in the mode register show current operating mode and provide limited mode switching during operation. the states of the bkgd, modb, and moda pins are latched into these bits on the rising edge of the reset signal. table 9 mode selection bkgd modb moda mode port a port b 1 0 0 normal single chip g.p. i/o g.p. i/o 1 0 1 normal expanded narrow addr/data addr 1 1 0 reserved (forced to peripheral) ?? 1 1 1 normal expanded wide addr/data addr/data 0 0 0 special single chip g.p. i/o g.p. i/o 0 0 1 special expanded narrow addr/data addr 1-modes
operating modes mc68hc912dt128a rev 2.0 64 operating modes motorola there are two basic types of operating modes: normal modes ? some registers and bits are protected against accidental changes. special modes ? allow greater access to protected control registers and bits for special purposes such as testing and emulation. a system development and debug feature, background debug mode (bdm), is available in all modes. in special single-chip mode, bdm is active immediately after reset. normal operating modes these modes provide three operating configurations. background debug is available in all three modes, but must first be enabled for some operations by means of a bdm background command, then activated. normal single-chip mode ? there are no external address and data buses in this mode. the mcu operates as a stand-alone device and all program and data resources are on-chip. external port pins normally associated with address and data buses can be used for general-purpose i/o. normal expanded wide mode ? this is a normal mode of operation in which the expanded bus is present with a 16-bit data bus. ports a and b are used for the 16-bit multiplexed address/data bus. normal expanded narrow mod e ? this is a normal mode of operation in which the expanded bus is present with an 8-bit data bus. ports a and b are used for the16-bit address bus. port a is used as the data bus, multiplexed with addresses. in this mode, 16-bit data is presented one byte at a time, the high byte followed by the low byte. the address is automatically incremented on the second cycle. 0 1 0 special peripheral addr/data addr/data 0 1 1 special expanded wide addr/data addr/data table 9 mode selection bkgd modb moda mode port a port b 2--modes
operating modes operating modes mc68hc912dt128a rev 2.0 motorola operating modes 65 special operating modes there are three special operating modes that correspond to normal operating modes. these operating modes are commonly used in factory testing and system development. in addition, there is a special peripheral mode, in which an external master, such as an i.c. tester, can control the on-chip peripherals. special single-chip mode ? this mode can be used to force the mcu to active bdm mode to allow system debug through the bkgd pin. there are no external address and data buses in this mode. the mcu operates as a stand-alone device and all program and data space are on-chip. external port pins can be used for general-purpose i/o. s pecial expanded wide mode ? this mode can be used for emulation of normal expanded wide mode and emulation of normal single-chip mode. ports a and b are used for the 16-bit multiplexed address/data bus. special expanded narrow mode ? this mode can be used for emulation of normal expanded narrow mode. ports a and b are used for the16-bit address bus. port a is used as the data bus, multiplexed with addresses. in this mode, 16-bit data is presented one byte at a time, the high byte followed by the low byte. the address is automatically incremented on the second cycle. special peripheral mode ? the cpu is not active in this mode. an external master can control on-chip peripherals for testing purposes. it is not possible to change to or from this mode without going through reset. background debugging should not be used while the mcu is in special peripheral mode as internal bus conflicts between bdm and the external master can cause improper operation of both functions. mode ? mode register $000b bit 7654321bit 0 smodn modb moda estr ivis ebswai emk eme reset:00011011special single chip reset:00111011special exp nar reset:01011011peripheral 3-modes
operating modes mc68hc912dt128a rev 2.0 66 operating modes motorola the mode register controls the mcu operating mode and various configuration options. this register is not in the map in peripheral mode smodn, modb, moda ? mode select special, b and a these bits show the current operating mode and reflect the status of the bkgd, modb and moda input pins at the rising edge of reset. read anytime. smodn may only be written if smodn = 0 (in special modes) but the first write is ignored. modb, moda may be written once if smodn = 1; anytime if smodn = 0 but the first write is ignored and in special peripheral and reserved modes cannot be selected. estr ? e clock stretch enable determines if the e clock behaves as a simple free-running clock or as a bus control signal that is active only for external bus cycles. estr is always one in expanded modes since it is required for address and data de-multiplexing and must follow stretched cycles. 0 = e never stretches (always free running). 1 = e stretches high during external access cycles and low during non-visible internal accesses (ivis = 0). normal modes: write once; special modes: write anytime, read anytime. ivis ? internal visibility this bit determines whether internal addr, data, r/w and lstrb signals can be seen on the external bus during accesses to internal locations. in special narrow mode if this bit is set and an internal access occurs the data will appear wide on ports a and b. this serves reset:01111011special exp wide reset:10010000normal single chip reset:10110000normal exp nar reset:11110000normal exp wide mode ? mode register $000b 4-modes
operating modes operating modes mc68hc912dt128a rev 2.0 motorola operating modes 67 the same function as the emd bit of the non-multiplexed versions of the hc12 and allows for emulation. visibility is not available when the part is operating in a single-chip mode. 0 = no visibility of internal bus operations on external bus. 1 = internal bus operations are visible on external bus. normal modes: write once; special modes: write anytime except the first time. read anytime. ebswai ? multiplexed external bus interface module stops in wait mode this bit controls access to the multiplexed external bus interface module during wait mode. the module will delay before shutting down in wait mode to allow for final bus activity to complete. 0 = mebi continues functioning during wait mode. 1 = mebi is shut down during wait mode. normal modes: write anytime; special modes: write never. read anytime. emk ? emulate port k in single-chip mode portk and ddrk are always in the map regardless of the state of this bit. 0 = port k and ddrk registers are in the memory map. memory expansion emulation is disabled and all pins are general purpose i/o. 1 = in expanded or peripheral mode, portk and ddrk are removed from the internal memory map. removing the registers from the map allows the user to emulate the function of these registers externally. normal modes: write once; special modes: write anytime except the first time. read anytime. eme ? emulate port e in single-chip mode porte and ddre are always in the map regardless of the state of this bit. 0 = porte and ddre are in the memory map. 5-modes
operating modes mc68hc912dt128a rev 2.0 68 operating modes motorola 1 = if in an expanded mode, porte and ddre are removed from the internal memory map. removing the registers from the map allows the user to emulate the function of these registers externally. normal modes: write once; special modes: write anytime except the first time. read anytime. background debug mode background debug mode (bdm) is an auxiliary operating mode that is used for system development. bdm is implemented in on-chip hardware and provides a full set of debug operations. some bdm commands can be executed while the cpu is operating normally. other bdm commands are firmware based, and require the bdm firmware to be enabled and active for execution. in special single-chip mode, bdm is enabled and active immediately out of reset. bdm is available in all other operating modes, but must be enabled before it can be activated. bdm should not be used in special peripheral mode because of potential bus conflicts. once enabled, background mode can be made active by a serial command sent via the bkgd pin or execution of a cpu12 bgnd instruction. while background mode is active, the cpu can interpret special debugging commands, and read and write cpu registers, peripheral registers, and locations in memory. while bdm is active, the cpu executes code located in a small on-chip rom mapped to addresses $ff20 to $ffff, and bdm control registers are accessible at addresses $ff00 to $ff06. the bdm rom replaces the regular system vectors while bdm is active. while bdm is active, the user memory from $ff00 to $ffff is not in the map except through serial bdm commands. 6-modes
mc68hc912dt128a rev 2.0 motorola resource mapping 69 resource mapping resource mapping contents introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 internal resource mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 flash eeprom mapping through internal memory expansion . . . . . 72 miscellaneous system control register . . . . . . . . . . . . . . . . . . . . . . . 77 mapping test registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 memory maps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 introduction after reset, most system resources can be mapped to other addresses by writing to the appropriate control registers. internal resource mapping the internal register block, ram, and eeprom have default locations within the 64k byte standard address space but may be reassigned to other locations during program execution by setting bits in mapping registers initrg, initrm, and initee. during normal operating modes these registers can be written once. it is advisable to explicitly establish these resource locations during the initialization phase of program execution, even if default values are chosen, in order to protect the registers from inadvertent modification later. writes to the mapping registers go into effect between the cycle that follows the write and the cycle after that. to assure that there are no unintended operations, a write to one of these registers should be followed with a nop instruction. 1-mapping
resource mapping mc68hc912dt128a rev 2.0 70 resource mapping motorola if conflicts occur when mapping resources, the register block will take precedence over the other resources; ram or eeprom addresses occupied by the register block will not be available for storage. when active, bdm rom takes precedence over other resources, although a conflict between bdm rom and register space is not possible. the following table shows resource mapping precedence. in expanded modes, all address space not used by internal resources is by default external memory. the mc68hc912dt128a contains 128k bytes of flash eeprom nonvolatile memory which can be used to store program code or static data. this physical memory is composed of four 32k byte array modules, 00fee32k, 01fee32k, 10fee32k and 11fee32k. the 32k byte array 11fee32k has a fixed location from $4000 to $7fff and $c000 to $ffff. the three 32k byte arrays 00fee32k, 01fee32k and 10fee32k are accessible through a 16k byte program page window mapped from $8000 to $bfff. the fixed 32k byte array 11fee32k can also be accessed through the program page window. register block mapping after reset the 1k byte register block resides at location $0000 but can be reassigned to any 2k byte boundary within the standard 64k byte address space. mapping of internal registers is controlled by five bits in the initrg register. the register block occupies the first 1k byte of the 2k byte block. table 10 mapping precedence precedence resource 1 bdm rom (if active) 2 register space 3ram 4eeprom 5 on-chip flash eeprom 6 external memory 2--mapping
resource mapping internal resource mapping mc68hc912dt128a rev 2.0 motorola resource mapping 71 reg[15:11] ? internal register map position these bits specify the upper five bits of the 16-bit registers address. normal modes: write once; special modes: write anytime. read anytime. mmswai ? memory mapping interface stop in wait control this bit controls access to the memory mapping interface when in wait mode. normal modes: write anytime; special modes: write never. read anytime. 0 = memory mapping interface continues to function during wait mode. 1 = memory mapping interface access is shut down during wait mode. ram mapping the mc68hc912dt128a has 8k bytes of fully static ram that is used for storing instructions, variables, and temporary data during program execution. since the ram is actually implemented with two 4k ram arrays, any misaligned word access between last address of first 4k ram and first address of second 4k ram will take two cycles instead of one. after reset, ram addressing begins at location $2000 but can be assigned to any 8k byte boundary within the standard 64k byte address space. mapping of internal ram is controlled by three bits in the initrm register. initrg ? initialization of internal register position register $0011 bit 7654321bit 0 reg15 reg14 reg13 reg12 reg11 0 0 mmswai reset: 0 0000000 initrm ? initialization of internal ram position register $0010 bit 7654321bit 0 ram15 ram14 ram13 0 0 0 0 0 reset: 0 0100000 3-mapping
resource mapping mc68hc912dt128a rev 2.0 72 resource mapping motorola ram[15:13] ? internal ram map position these bits specify the upper three bits of the 16-bit ram address. normal modes: write once; special modes: write anytime. read anytime. eeprom mapping the mc68hc912dt128a has 2k bytes of eeprom which is activated by the eeon bit in the initee register. mapping of internal eeprom is controlled by four bits in the initee register. after reset eeprom address space begins at location $0800 but can be mapped to any 4k byte boundary within the standard 64k byte address space. the eeprom block occupies the last 2k bytes of the 4k byte block. ee[15:12] ? internal eeprom map position these bits specify the upper four bits of the 16-bit eeprom address. normal modes: write once; special modes: write anytime. read anytime. eeon ? internal eeprom on (enabled) read or write anytime. 0 = removes the eeprom from the map. 1 = places the on-chip eeprom in the memory map at the address selected by ee[15:12]. flash eeprom mapping through internal memory expansion the page index register or ppage provides memory management for the mc68hc912dt128a. ppage consists of three bits to indicate which physical location is active within the windows of the mc68hc912dt128a. the mc68hc912dt128a has a user ? s program initee ? initialization of internal eeprom position register $0012 bit 7654321bit 0 ee15 ee14 ee13 ee12 0 0 0 eeon reset: 0 0000001 4-mapping
resource mapping flash eeprom mapping through internal memory expansion mc68hc912dt128a rev 2.0 motorola resource mapping 73 space window, a register space window for flash module registers, and a test program space window. the user ? s program page window consists of 16k flash eeprom bytes. one of eight pages is viewed through this window for a total of 128k accessible flash eeprom bytes. the register space window consists of a 4-byte register block. one of four pages is viewed through this window for each of the 32k flash module register blocks of mc68hc912dt128a. the test mode program page window consists of 32k flash eeprom bytes. one of the four 32k byte arrays is viewed through this window for a total 128k accessible flash eeprom bytes. this window is only available in special mode for test purposes and replaces the user ? s program page window. mc68hc912dt128a has a five pin port, port k, for emulation and for general purpose i/o. three pins are used to emulate the three page indices (ppage bits) and one pin is used as an emulation chip select. when these four pins are not used for emulation they serve as general purpose i/o pins. the fifth port k pin is used as a general purpose i/o pin. program space expansion there are 128k bytes of flash eeprom for mc68hc912dt128a. with a 64k byte address space, the ppage register is needed to perform on chip memory expansion. a program space window of 16k byte pages is located from $8000 to $bfff. three page indices are used to point to one of eight different 16k byte pages. table 11 program space page index page index 2 (ppage bit 2) page index 1 (ppage bit 1) page index 0 (ppage bit 0) 16k program space page flash array 0 0 0 16k byte page 0 00fee32k 0 0 1 16k byte page 1 00fee32k 0 1 0 16k byte page 2 01fee32k 0 1 1 16k byte page 3 01fee32k 1 0 0 16k byte page 4 10fee32k 1 0 1 16k byte page 5 10fee32k 5-mapping
resource mapping mc68hc912dt128a rev 2.0 74 resource mapping motorola * the 16k byte flash in program space page 6 can also be accessed at a fixed location from $4000 to $7fff. the 16k byte flash in program space page 7 can also be accessed at a fixed location from $c000 to $ffff. flash register space expansion there are four 32k flash arrays for mc68hc912dt128a and each requires a 4-byte register block. a register space window is used to access one of the four 4-byte blocks and the ppage register to map each one into the window. the register space window is located from $00f4 to $00f7 after reset. only two page indices are used to point to one of the four pages of the register space. test mode program space expansion in special mode and for test purposes only, the 128k bytes of flash eeprom for mc68hc912dt128a can be accessed through a test program space window of 32k bytes. this window replaces the user ? s program space window to be able to access an entire array. in special mode and with romtst bit set in misc register, a program space is located from $8000 to $ffff. only two page indices are used to point to one of the four 32k byte arrays. these indices can be viewed as expanded addresses x16 and x15. 1 1 0 16k byte page 6* 11fee32k 1 1 1 16k byte page 7* 11fee32k table 11 program space page index page index 2 (ppage bit 2) page index 1 (ppage bit 1) page index 0 (ppage bit 0) 16k program space page flash array table 12 flash register space page index page index 2 (ppage bit 2) page index 1 (ppage bit 1) page index 0 (ppage bit 0) flash register space page flash array 0 0 x $00f4-$00f7 page 0 00fee32k 0 1 x $00f4-$00f7 page 1 01fee32k 1 0 x $00f4-$00f7 page 2 10fee32k 1 1 x $00f4-$00f7 page 3 11fee32k 6-mapping
resource mapping flash eeprom mapping through internal memory expansion mc68hc912dt128a rev 2.0 motorola resource mapping 75 7-mapping page index register descriptions read and write anytime writes do not change pin state when pin configured for page index emulation output. this port is associated with page index emulation pins. when the port is not enabled to emulate page index, the port pins are used as general-purpose i/o. port k bit 3 is used as a general purpose i/o pin only. this register is not in the map in peripheral or expanded modes while the emk control bit in mode register is set. when inputs, these pins can be selected to be high impedance or pulled up. ecs ? emulation chip select of selected program space when this signal is active low it indicates that the program space is accessed. this also applies to test mode program space. an access is made if address is at the program space window and either the flash or external memory is accessed. the ecs timing is e clock high table 13 test mode program space page index page index 2 (ppage bit 2) page index 1 (ppage bit 1) page index 0 (ppage bit 0) flash register space page flash array 0 0 x 32k byte array page 0 00fee32k 0 1 x 32k byte array page 1 01fee32k 1 0 x 32k byte array page 2 10fee32k 1 1 x 32k byte array page 3 11fee32k portk ? port k data register $00fc bit 7 6 5 4 3 2 1 bit 0 port pk7 0 0 0 pk3 pk2 pk1 pk0 emulation ecs 0 0 0 - pix2 pix1 pix0 reset: - 0 0 0 - - - -
resource mapping mc68hc912dt128a rev 2.0 76 resource mapping motorola and can be stretched when accessing external memory depending on the extr0 and extr1 bits in the misc register. the ecs signal is only active when the emk bit is set. pix[2:0] ? the content of the ppage register emulated externally. this content indicates which flash module register space is in the memory map and which 16k byte flash memory is in the program space. in special mode and with romtst bit set, the content of the page index register indicates which 32k byte flash array is in the test program space. i read and write: anytime. this register determines the primary direction for each port k pin configured as general-purpose i/o. 0 = associated pin is a high-impedance input. 1 = associated pin is an output. this register is not in the map in peripheral or expanded modes while the emk control bit is set. read and write: anytime. this register determines the active page viewed through mc68hc912dt128a windows. ddrk ? port k data direction register $00fd bit 7 6 5 4 3 2 1 bit 0 ddk7 0 0 0 ddk3 ddk2 ddk1 ddk0 reset: 0 0 0 0 0 0 0 0 ppage ? (program) page index register $00ff bit 7 6 5 4 3 2 1 bit 0 0 0 0 0 0 pix2 pix1 pix0 reset: 0 0 0 0 0 0 0 0 8-mapping
resource mapping miscellaneous system control register mc68hc912dt128a rev 2.0 motorola resource mapping 77 9-mapping call and rtc instructions have a special single wire mechanism to read and write this register without using an address bus. miscellaneous system control register additional mapping and external resource controls are available. to use external resources the part must be operated in one of the expanded modes. normal modes: write once; special modes: write anytime. read anytime. romtst ? flash eeprom test mode in normal modes, this bit is forced to zero. 0 = 16k window for flash memory is located from $8000-$bfff 1 = 32k window for flash memory is located from $8000-$ffff ndrf ? narrow data bus for register-following map space this bit enables a narrow bus feature for the 1k byte register-following map. this is useful for accessing 8-bit peripherals and allows 8-bit and 16-bit external memory devices to be mixed in a system. in expanded narrow (eight bit) modes, single chip modes, and peripheral mode, this bit has no effect. 0 = makes register-following map space act as a full 16 bit data bus. 1 = makes the register-following map space act the same as an 8 bit only external data bus (data only goes through port a externally). misc ? miscellaneous mapping control register $0013 bit 7654321bit 0mode romtst ndrf rfstr1 rfstr0 exstr1 exstr0 romhm romon reset: 0 0 0 0 1 1 0 0 exp mode reset: 0 0 0 0 1 1 0 1 peripheral or sc mode
resource mapping mc68hc912dt128a rev 2.0 78 resource mapping motorola the register-following space is mapped from $0400 to $07ff after reset, which is next to the register map. if the registers are moved this space follows. rfstr1, rfstr0 ? register following stretch this two bit field determines the amount of clock stretch on accesses to the 1k byte register following map. it is valid regardless of the state of the ndrf bit. in single chip and peripheral modes this bit has no meaning or effect. exstr1, exstr0 ? external access stretch this two bit field determines the amount of clock stretch on accesses to an external address space. in single chip and peripheral modes this bit has no meaning or effect. romhm ? flash eeprom only in second half of map this bit has no meaning if romon bit is clear. 0 = the 16k byte of fixed flash eeprom in location $4000-$7fff can be accessed. table 14 rfstr stretch bit definition rfstr1 rfstr0 number of e clocks stretched 00 0 01 1 10 2 11 3 table 15 exstr stretch bit definition exstr1 exstr0 number of e clocks stretched 00 0 01 1 10 2 11 3 10-mapping
resource mapping mapping test registers mc68hc912dt128a rev 2.0 motorola resource mapping 79 11-mapping 1 = disables direct access to 16k byte flash eeprom from $4000-$7fff in the memory map. the physical location of this16k byte flash can still be accessed through the program page window. in special mode and with romtst bit set, this bit will allow overlap of the four 32k flash arrays and overlap the four 4-byte flash register space in the same map space to be able to program all arrays at the same time. 0 = the four 32k flash arrays are accessed with four pages for each. 1 = the four 32k flash arrays coincide in the same space and are selected at the same time for programming. caution: bit must be cleared before reading any of the arrays or registers. romon ? enable flash eeprom these bits are used to enable the flash eeprom arrays. 0 = disables flash eeprom in the memory map. 1 = enables flash eeprom in the memory map. mapping test registers these registers are used in for testing the mapping logic. they can only be read and after each read they get cleared. a write to each register will have no effect. mtst0 ? mapping test register 0 $00f8 bit 7654321bit 0 mt07 mt06 mt05 mt04 mt03 mt02 mt01 mt00 reset: 00000000 mtst1 ? mapping test register 1 $00f9 bit 7654321bit 0 mt0f mt0e mt0d mt0c mt0b mt0a mt09 mt08 reset: 00000000
resource mapping mc68hc912dt128a rev 2.0 80 resource mapping motorola memory maps the following diagrams illustrate the memory map for each mode of operation immediately after reset. mtst2 ? mapping test register 2 $00fa bit 7654321bit 0 mt17 mt16 mt15 mt14 mt13 mt12 mt11 mt10 reset: 0 0 0 00000 mtst3 ? mapping test register 3 $00fb bit 7654321bit 0 mt1f mt1e mt1d mt1c mt1b mt1a mt19 mt18 reset: 0 0 0 00000 12-mapping
resource mapping memory maps mc68hc912dt128a rev 2.0 motorola resource mapping 81 13-mapping figure 10 mc68hc912dt128a memory map after reset the following diagram illustrates the memory paging scheme. $03ff registers (mappable to any 2k space) 8k bytes ram (mappable to any 8k space) expanded normal single chip special single chip $0000 $3fff $2000 2k bytes eeprom (mappable to any 4k space) $0fff $0800 vectors vectors vectors bdm (if active) $ffff $ff00 16k page window eight 16k flash eeprom pages $bfff $8000 ext $a000 - $bfff protected boot at odd programing pages $0000 $2000 $0800 $1000 $8000 $ff00 $ffff $0400 16k fixed flash eeprom $4000 16k fixed flash eeprom $ffff $c000 $e000 - $ffff protected boot $4000 $c000
resource mapping mc68hc912dt128a rev 2.0 82 resource mapping motorola figure 11 mc68hc912dt128a memory paging * this 32k flash accessible as pages 6 & 7 and as unpaged $4000 - $7fff & $c000 - $ffff 0 normal single chip 00 flash 32k vectors one 16k page accessible at a time (selected by ppage value = 0 to 7) $0000 $2000 $0800 $1000 $8000 $ff00 $ffff $0400 16k flash (unpaged) $4000 $c000 1234567 6 7 01 flash 32k 10 flash 32k 11 flash 32k * 16k flash (unpaged) 16k flash (paged) (8k boot) (8k boot) (8k boot) (8k boot) (8k boot) $e000 14-mapping
mc68hc912dt128a rev 2.0 motorola bus control and input/output 83 bus control and input/output bus control and input/output contents introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 detecting access type from external signals . . . . . . . . . . . . . . . . . . 83 registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 introduction internally the mc68hc912dt128a has full 16-bit data paths, but depending upon the operating mode and control registers, the external multiplexed bus may be 8 or 16 bits. there are cases where 8-bit and 16-bit accesses can appear on adjacent cycles using the lstrb signal to indicate 8- or 16-bit data. it is possible to have a mix of 8 and 16 bit peripherals attached to the external multiplexed bus, using the ndrf bit in the misc register while in expanded wide modes. detecting access type from external signals the external signals lstrb , r/w , and a0 can be used to determine the type of bus access that is taking place. accesses to the internal ram module are the only type of access that produce lstrb =a0=1, because the internal ram is specifically designed to allow misaligned 16-bit accesses in a single cycle. in these cases the data for the address that was accessed is on the low half of the data bus and the data for address + 1 is on the high half of the data bus. 1-bus
bus control and input/output mc68hc912dt128a rev 2.0 84 bus control and input/output motorola registers not all registers are visible in the mc68hc912dt128a memory map under certain conditions. in special peripheral mode the first 16 registers associated with bus expansion are removed from the memory map. in expanded modes, some or all of port a, port b, and port e are used for expansion buses and control signals. in order to allow emulation of the single-chip functions of these ports, some of these registers must be rebuilt in an external port replacement unit. in any expanded mode, port a, and port b, are used for address and data lines so registers for these ports, as well as the data direction registers for these ports, are removed from the on-chip memory map and become external accesses. in any expanded mode, port e pins may be needed for bus control (e.g., eclk, r/w ). to regain the single-chip functions of port e, the emulate port e (eme) control bit in the mode register may be set. in this special case of expanded mode and eme set, porte and ddre registers are removed from the on-chip memory map and become external accesses so port e may be rebuilt externally. table 16 access type vs. bus control pins lstrb a0 r/w type of access 1 0 1 8-bit read of an even address 0 1 1 8-bit read of an odd address 1 0 0 8-bit write of an even address 0 1 0 8-bit write of an odd address 0 0 1 16-bit read of an even address 111 16-bit read of an odd address (low/high data swapped) 0 0 0 16-bit write to an even address 110 16-bit write to an odd address (low/high data swapped) 2--bus
bus control and input/output registers mc68hc912dt128a rev 2.0 motorola bus control and input/output 85 bits pa[7:0] are associated respectively with addresses addr[15:8], data[15:8] and data[7:0], in narrow mode. when this port is not used for external addresses such as in single-chip mode, these pins can be used as general-purpose i/o. ddra determines the primary direction of each pin. this register is not in the on-chip map in expanded and peripheral modes. read and write anytime. this register determines the primary direction for each port a pin when functioning as a general-purpose i/o port. ddra is not in the on-chip map in expanded and peripheral modes. read and write anytime. 0 = associated pin is a high-impedance input 1 = associated pin is an output porta ? port a register $0000 bit 7654321bit 0 single chip pa7 pa6 pa5 pa4 pa3 pa2 pa1 pa0 reset: ???????? expanded & periph: addr15/ data15 addr14/ data14 addr13/ data13 addr12/ data12 addr11/ data11 addr10/ data10 addr9/ data9 addr8/ data8 expanded narrow addr15/ data15/ data7 addr14/ data14/ data6 addr13/ data13/ data5 addr12/ data12/ data4 addr11/ data11/ data3 addr10/ data10/ data2 addr9/ data9/ data1 addr8/ data8/ data0 ddra ? port a data direction register $0002 bit 7654321bit 0 dda7 dda6 dda5 dda4 dda3 dda2 dda1 dda0 reset: 00000000 portb ? port b register $0001 bit 7654321bit 0 single chip pb7 pb6 pb5 pb4 pb3 pb2 pb1 pb0 reset: ???????? expanded & periph: addr7/ data7 addr6/ data6 addr5/ data5 addr4/ data4 addr3/ data3 addr2/ data2 addr1/ data1 addr0/ data0 expanded narrow addr7 addr6 addr5 addr4 addr3 addr2 addr1 addr0 3-bus
bus control and input/output mc68hc912dt128a rev 2.0 86 bus control and input/output motorola bits pb[7:0] are associated with addresses addr[7:0] and data[7:0] (except in narrow mode) respectively. when this port is not used for external addresses such as in single-chip mode, these pins can be used as general-purpose i/o. ddrb determines the primary direction of each pin. this register is not in the on-chip map in expanded and peripheral modes. read and write anytime. this register determines the primary direction for each port b pin when functioning as a general-purpose i/o port. ddrb is not in the on-chip map in expanded and peripheral modes. read and write anytime. 0 = associated pin is a high-impedance input 1 = associated pin is an output this register is associated with external bus control signals and interrupt inputs, including data bus enable (dbe ), mode select (modb/ipipe1, moda/ipipe0), e clock, size (lstrb ), read/write (r/w ), irq , and xirq . when the associated pin is not used for one of these specific functions, the pin can be used as general-purpose i/o. the port e assignment register (pear) selects the function of each pin. ddre determines the primary direction of each port e pin when configured to be general-purpose i/o. some of these pins have software selectable pull-ups (dbe , lstrb , r/w , irq and xirq ). a single control bit enables the pull-ups for all these pins which are configured as inputs. ddrb ? port b data direction register $0003 bit 7654321bit 0 ddb7 ddb6 ddb5 ddb4 ddb3 ddb2 ddb1 ddb0 reset: 00000000 porte ? port e register $0008 bit 7654321bit 0 pe7 pe6 pe5 pe4 pe3 pe2 pe1 pe0 reset: ???????? alt. pin function dbe or eclk or cal modb or ipipe1 or cgmtst moda or ipipe0 eclk lstrb or taglo r/w irq xirq 4-bus
bus control and input/output registers mc68hc912dt128a rev 2.0 motorola bus control and input/output 87 this register is not in the map in peripheral mode or expanded modes when the eme bit is set. read and write anytime. this register determines the primary direction for each port e pin configured as general-purpose i/o. 0 = associated pin is a high-impedance input 1 = associated pin is an output pe[1:0] are associated with xirq and irq and cannot be configured as outputs. these pins can be read regardless of whether the alternate interrupt functions are enabled. this register is not in the map in peripheral mode and expanded modes while the eme control bit is set. read and write anytime. port e serves as general purpose i/o lines or as system and bus control signals. the pear register is used to choose between the general-purpose i/o functions and the alternate bus control functions. when an alternate control function is selected, the associated ddre bits are overridden. ddre ? port e data direction register $0009 bit 7654321bit 0 dde7 dde6 dde5 dde4 dde3 dde2 0 0 reset: 0 0 0 0 0 0 0 0 pear ? port e assignment register $000a bit 7654321bit 0 ndbe cgmte pipoe neclk lstre rdwe cale dbene reset: 0 0000000 normal ex- panded reset: 0 0101100 special ex- panded reset: 1 1010000peripheral reset: 1 0010000 normal sin- gle chip reset: 0 0101100 special sin- gle chip 5-bus
bus control and input/output mc68hc912dt128a rev 2.0 88 bus control and input/output motorola the reset condition of this register depends on the mode of operation because bus control signals are needed immediately after reset in some modes. in normal single-chip mode, no external bus control signals are needed so all of port e is configured for general-purpose i/o. in normal expanded modes, the reset vector is located in external memory. the dbe and e clock are required for de-multiplexing address and data but lstrb and r/w are only needed by the system when there are external writable resources. therefore in normal expanded modes, the dbe and the e clock are configured for their alternate bus control functions and the other bits of port e are configured for general-purpose i/o. if the normal expanded system needs any other bus control signals, pear would need to be written before any access that needed the additional signals. in special expanded modes, dbe , ipipe1, ipipe0, e, lstrb , and r/w are configured as bus-control signals. in special single chip modes, dbe , ipipe1, ipipe0, e, lstrb , r/w, and cale are configured as bus-control signals. in peripheral mode, the pear register is not accessible for reads or writes. however, the cgmte control bit is reset to one to configure pe6 as a test output for the cgm module. ndbe ? no data bus enable normal: write once; special: write anytime except the first. read anytime. 0 = pe7 is used for dbe , external control of data enable on memories, or inverted e clock. 1 = pe7 is cal function if cale bit is set in pear register or general-purpose i/o otherwise. the ndbe bit has no effect in single chip or peripheral modes and pe7 is defaulted to the cal function if cale bit is set in pear register or to an i/o otherwise. cgmte ? clock generator module testing enable normal: write never; special: write anytime except the first time. read anytime. 0 = pe6 is general-purpose i/o or pipe output. 6-bus
bus control and input/output registers mc68hc912dt128a rev 2.0 motorola bus control and input/output 89 7-bus 1 = pe6 is a test signal output from the cgm module (no effect in single chip or normal expanded modes). pipoe = 1 overrides this function and forces pe6 to be a pipe status output signal. pipoe ? pipe status signal output enable normal: write once; special: write anytime except the first time. read anytime. 0 = pe[6:5] are general-purpose i/o (if cgmte = 1, pe6 is a test output signal from the cgm module). 1 = pe[6:5] are outputs and indicate the state of the instruction queue (only effective in expanded modes). neclk ? no external e clock normal single chip: write once; special single chip: write anytime; all other modes: write never. read anytime. in peripheral mode, e is an input and in all other modes, e is an output. 0 = pe4 is the external e-clock pin subject to the following limitation: in single-chip modes, to get an e clock output signal, it is necessary to have estr = 0 in addition to neclk = 0. a 16-bit write to pear and mode registers can configure all three bits in one operation. 1 = pe4 is a general-purpose i/o pin. lstre ? low strobe (lstrb ) enable normal: write once; special: write anytime except the first time. read anytime. this bit has no effect in single-chip modes or normal expanded narrow mode. 0 = pe3 is a general-purpose i/o pin. 1 = pe3 is configured as the lstrb bus-control output, provided the mcu is not in single chip or normal expanded narrow modes. lstrb is used during external writes. after reset in normal expanded mode, lstrb is disabled. if needed, it should be enabled before external writes. external reads do not normally need lstrb because all 16 data bits can be driven even if the mcu only needs 8 bits of data.
bus control and input/output mc68hc912dt128a rev 2.0 90 bus control and input/output motorola taglo is a shared function of the pe3/lstrb pin. in special expanded modes with lstre set and the bdm tagging on, a zero at the falling edge of e tags the instruction word low byte being read into the instruction queue. rdwe ? read/write enable normal: write once; special: write anytime except the first time. read anytime. this bit has no effect in single-chip modes. 0 = pe2 is a general-purpose i/o pin. 1 = pe2 is configured as the r/w pin. in single chip modes, rdwe has no effect and pe2 is a general-purpose i/o pin. r/w is used for external writes. after reset in normal expanded mode, it is disabled. if needed it should be enabled before any external writes. cale ? calibration reference enable read and write anytime. 0 = calibration reference is disabled and pe7 is general purpose i/o in single chip or peripheral modes or if ndbe bit is set. 1 = calibration reference is enabled on pe7 in single chip and peripheral modes or if ndbe bit is set. dbene ? dbe or inverted e clock on pe7 normal modes: write once. special modes: write anytime except the first time. read anytime. dbene controls which signal is output on pe7 when ndbe control bit is cleared. the inverted e clock output can be used to latch the address for de-multiplexing. it has the same behavior as the e clock, except it is inverted. please note that in the case of idle expansion bus, the ? not e clock ? signal could stay high for many cycles. the dbene bit has no effect in single chip or peripheral modes and pe7 is defaulted to the cal function if cale bit is set in pear register or to an i/o otherwise. 0 = pe7 pin used for dbe external control of data enable on memories in expanded modes when ndbe = 0 1 = pe7 pin used for inverted e clock output in expanded modes when ndbe = 0 8-bus
bus control and input/output registers mc68hc912dt128a rev 2.0 motorola bus control and input/output 91 9-bus these bits select pull-up resistors for any pin in the corresponding port that is currently configured as an input. this register is not in the map in peripheral mode. read and write anytime. pupk ? pull-up port k enable 0 = port k pull-ups are disabled. 1 = enable pull-up devices for all port k input pins. pupj ? pull-up or pull-down port j enable 0 = port j resistive loads (pull-ups or pull-downs) are disabled. 1 = enable resistive load devices (pull-ups or pull-downs) for all port j input pins. puph ? pull-up or pull-down port h enable 0 = port h resistive loads (pull-ups or pull-downs) are disabled. 1 = enable resistive load devices (pull-ups or pull-downs) for all port h input pins. pupe ? pull-up port e enable 0 = port e pull-ups on pe7, pe3, pe2, pe1 and pe0 are disabled. 1 = enable pull-up devices for port e input pins pe7, pe3, pe2, pe1 and pe0. when this bit is set port e input pins 7, 3, 2, 1 & 0 have an active pull-up device. pupb ? pull-up port b enable 0 = port b pull-ups are disabled. 1 = enable pull-up devices for all port b input pins. pupa ? pull-up port a enable 0 = port a pull-ups are disabled. 1 = enable pull-up devices for all port a input pins. pucr ? pull-up control register $000c bit 7654321bit 0 pupk pupj puph pupe 0 0 pupb pupa reset: 00010000
bus control and input/output mc68hc912dt128a rev 2.0 92 bus control and input/output motorola these bits select reduced drive for the associated port pins. this gives reduced power consumption and reduced rfi with a slight increase in transition time (depending on loading). the reduced drive function is independent of which function is being used on a particular port. this register is not in the map in peripheral mode. normal: write once; special: write anytime except the first time. read anytime. rdpk ? reduced drive of port k 0 = all port k output pins have full drive enabled. 1 = all port k output pins have reduced drive capability. rdpj ? reduced drive of port j 0 = all port j output pins have full drive enabled. 1 = all port j output pins have reduced drive capability. rdph ? reduced drive of port h 0 = all port h output pins have full drive enabled. 1 = all port h output pins have reduced drive capability. rdpe ? reduced drive of port e 0 = all port e output pins have full drive enabled. 1 = all port e output pins have reduced drive capability. rdpb ? reduced drive of port b 0 = all port b output pins have full drive enabled. 1 = all port b output pins have reduced drive capability. rdpa ? reduced drive of port a 0 = all port a output pins have full drive enabled. 1 = all port a output pins have reduced drive capability. rdriv ? reduced drive of i/o lines $000d bit 7654321bit 0 rdpk rdpj rdph rdpe 0 0 rdpb rdpa reset: 0 0000000 10-bus
mc68hc912dt128a rev 2.0 motorola flash eeprom 93 flash eeprom flash eeprom contents introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 flash eeprom control block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 flash eeprom arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 flash eeprom registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 programming the flash eeprom . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 erasing the flash eeprom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 stop or wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 introduction the four flash eeprom array modules 00fee32k, 01fee32k, 10fee32k and 11fee32k for the mc68hc912dt128a serve as electrically erasable and programmable, non-volatile rom emulation memory. the modules can be used for program code that must either execute at high speed or is frequently executed, such as operating system kernels and standard subroutines, or they can be used for static data which is read frequently. the flash eeprom module is ideal for program storage for single-chip applications allowing for field reprogramming. overview each 32k flash eeprom array is arranged in a 16-bit configuration and may be read as either bytes, aligned words or misaligned words. access 1-flash
flash eeprom mc68hc912dt128a rev 2.0 94 flash eeprom motorola time is one bus cycle for byte and aligned word access and two bus cycles for misaligned word operations. programming is by aligned word. the flash eeprom module supports bulk erase only. each flash eeprom module has hardware interlocks which protect stored data from accidental corruption. an erase- and program-protected 8-kbyte block for boot routines is located at the top of each 32-kbyte array. since boot programs must be available at all times, the only useful boot block is at $e000 ? $ffff location. all paged boot blocks can be used as protected program space if desired. flash eeprom control block a 4-byte register block for each module controls the flash eeprom operation. configuration information is specified and programmed independently from the contents of the flash eeprom array. at reset, the 4-byte register section starts at address $00f4 and points to the 00fee32k register block. flash eeprom arrays after reset, a fixed 32k flash eeprom array, 11fee32k, is located from addresses $4000 to $7fff and from $c000 to $ffff. the other three 32k flash eeprom arrays 00fee32k, 01fee32k and 10fee32k, are mapped through a 16k byte program page window located from addresses $8000 to $bfff. the page window has eight 16k byte pages. the last two pages also map the physical location of the fixed 32k flash eeprom array 11fee32k. in expanded modes, the flash eeprom arrays are turned off. see operating modes . 2--flash
flash eeprom flash eeprom registers mc68hc912dt128a rev 2.0 motorola flash eeprom 95 flash eeprom registers each 32k byte flash eeprom module has a set of registers. the register space $00f4-$00f7 is in a register space window of four pages. each register page of four bytes maps the register space for each flash module and each page is selected by the ppage register. see resource mapping in normal modes the lock bit can only be written once after reset. lock ? lock register bit 0 = enable write to feemcr register 1 = disable write to feemcr register this register controls the operation of the flash eeprom array. bootp cannot be changed when the lock control bit in the feelck register is set or if enpe in the feectl register is set. bootp ? boot protect the boot blocks are located at $e000 ? $ffff and $a000 ? $bfff for odd program pages for each flash eeprom module. since boot programs must be available at all times, the only useful boot block is at $e000 ? $ffff location. all paged boot blocks can be used as protected program space if desired. 0 = enable erase and program of 8k byte boot block 1 = disable erase and program of 8k byte boot block feelck ? flash eeprom lock control register $00f4 bit 7 6 5 4 3 2 1 bit 0 0 0 0 0 0 0 0 lock reset: 0 0 0 0 0 0 0 0 feemcr ? flash eeprom module configuration register $00f5 bit 7 6 5 4 3 2 1 bit 0 0 0 0 0 0 0 0 bootp reset: 0 0 0 0 0 0 0 1 3-flash
flash eeprom mc68hc912dt128a rev 2.0 96 flash eeprom motorola this register controls the programming and erasure of the flash eeprom. feeswai ? flash eeprom stop in wait control 0 = do not halt flash eeprom clock when the part is in wait mode. 1 = halt flash eeprom clock when the part is in wait mode. hven ? high-voltage enable this bit enables the charge pump to supply high voltages for program and erase operations in the array. hven can only be set if either pgm or eras are set and the proper sequence for program or erase is followed. 0 = disables high voltage to array and charge pump off 1 = enables high voltage to array and charge pump on eras ? erase control this bit configures the memory for erase operation. eras is interlocked with the pgm bit such that both bits cannot be equal to 1 or set to1 at the same time. 0 = erase operation is not selected. 1 = erase operation selected. pgm ? program control this bit configures the memory for program operation. pgm is interlocked with the eras bit such that both bits cannot be equal to 1 or set to1 at the same time. 0 = program operation is not selected. 1 = program operation selected. feectl ? flash eeprom control register $00f7 bit 7 6 5 4 3 2 1 bit 0 0 0 0 feeswai hven 0 eras pgm reset: 0 0 0 0 0 0 0 0 4-flash
flash eeprom operation mc68hc912dt128a rev 2.0 motorola flash eeprom 97 operation the flash eeprom can contain program and data. on reset, it can operate as a bootstrap memory to provide the cpu with internal initialization information during the reset sequence. bootstrap operation single-chip mode after reset, the cpu controlling the system will begin booting up by fetching the first program address from address $fffe. normal operation the flash eeprom allows a byte or aligned word read in one bus cycle. misaligned word read require an additional bus cycle. the flash eeprom array responds to read operations only. write operations are ignored. program/erase operation an unprogrammed flash eeprom bit has a logic state of one. a bit must be programmed to change its state from one to zero. erasing a bit returns it to a logic one. the flash eeprom has a minimum program/erase life of 100 cycles. programming or erasing the flash eeprom is accomplished by a series of control register writes. programming is restricted to aligned word at a time as determined by internal signal sz8 and addr[0]. the flash eeprom must first be completely erased prior to programming final data values. programming and erasing of flash locations cannot be performed by code being executed from the flash memory. while these operations must be performed in the order shown, other unrelated operations may occur between the steps. do not exceed t fpgm maximum (40 s). programming the flash eeprom programming the flash eeprom is done on a row basis. a row consists of 64 consecutive bytes starting from addresses $xx00, $xx40, $xx80 5-flash
flash eeprom mc68hc912dt128a rev 2.0 98 flash eeprom motorola and $xxc0. use this step-by-step procedure to program a row of flash memory. 1. set the pgm bit. this configures the memory for program operation and enables the latching of address and data for programming. 2. write to any flash address with any data within the row address range desired. 3. wait for a time, t nvs (min. 10 s). 4. set the hven bit. 5. wait for a time, t pgs (min. 5 s). 6. write to the flash address with data to the word desired to be programmed. if bootp is asserted, an attempt to program an address in the boot block will be ignored. 7. wait for a time, t fpgm (min. 30 s). 8. repeat step 6 and 7 until all the words within the row are programmed. 9. clear the pgm bit. 10. wait for a time, t nvh (min. 5 s). 11. clear the hven bit. 12. after time, t rcv (min 1 s), the memory can be accessed in read mode again. this program sequence is repeated throughout the memory until all data is programmed. for minimum overall programming time and least program disturb effect, the sequence should be part of an intelligent operation which iterates per row. erasing the flash eeprom the following sequence demonstrates the recommended procedure for erasing any of the flash eeprom array. 1. set the eras bit. 2. write to any valid address in the flash array. the data written and the address written are not important. the boot block will be 6-flash
flash eeprom stop or wait mode mc68hc912dt128a rev 2.0 motorola flash eeprom 99 7-flash erased only if the control bit bootp is negated. 3. wait for a time, t nvs . 4. set the hven bit. 5. wait for a time, t eras . 6. clear the eras bit. 7. wait for a time, t nvhl . 8. clear the hven bit. 9. after time, t rcv , the memory can be accessed in read mode again. stop or wait mode when stop or wait commands are executed, the mcu puts the flash eeprom in stop or wait mode. in these modes the flash module will cease erasure or programming immediately. caution: it is advised not to enter stop or wait modes when program or erase operation of the flash array is in progress.
flash eeprom mc68hc912dt128a rev 2.0 100 flash eeprom motorola 8-flash
mc68hc912dt128a rev 2.0 motorola eeprom 101 eeprom eeprom contents introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 eeprom selective write more zeros . . . . . . . . . . . . . . . . . . . . . . . 102 eeprom programmer ? s model . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 eeprom control registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 program/erase operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 shadow word mapping. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 programming eedivh and eedivl registers . . . . . . . . . . . . . . . . . 112 introduction the mc68hc912dt128a eeprom nonvolatile memory is arranged in a 16-bit configuration. the eeprom array may be read as either bytes, aligned words or misaligned words. access times are one bus cycle for byte and aligned word access and two bus cycles for misaligned word operations. programming is by byte or aligned word. attempts to program or erase misaligned words will fail. only the lower byte will be latched and programmed or erased. programming and erasing of the user eeprom can be done in normal modes. each eeprom byte or aligned word must be erased before programming. the eeprom module supports byte, aligned word, row (32 bytes) or bulk erase, all using the internal charge pump. the erased state is $ff. the eeprom module has hardware interlocks which protect stored data from corruption by accidentally enabling the program/erase voltage. programming voltage is derived from the internal v dd supply with an internal charge pump. 1-eeprom
eeprom mc68hc912dt128a rev 2.0 102 eeprom motorola eeprom selective write more zeros the eeprom can be programmed such that one or multiple bits are programmed (written to a logic ? 0 ? ) at a time. however, the user should may never program one bit more than once before erasing the entire byte. in other words, the user is not allowed to over write a logic ? 0 ? with another ? 0 ? . for some applications it may be advantageous to track more than 10k events with a single byte of eeprom by programming one bit at a time. for that purpose, a special selective bit programming technique is available. an example is shown here. original state of byte = binary 1111:1111 (erased) first event is recorded by programming bit position 0 program write = binary 1111:1110; result = binary 1111:1110 second event is recorded by programming bit position 1 program write = binary 1111:1101; result = binary 1111:1100 third event is recorded by programming bit position 2 program write = binary 1111:1011; result = binary 1111:1000 fourth event is recorded by programming bit position 3 program write = binary 1111:0111; result = binary 1111:0000 events five through eight are recorded in a similar fashion. note that none of the bit locations are actually programmed more than once although the byte was programmed eight times. when this technique is utilized, a program / erase cycle is defined as multiple writes (up to eight) to a unique location followed by a single erase sequence. 2--eeprom
eeprom eeprom programmer ? s model mc68hc912dt128a rev 2.0 motorola eeprom 103 eeprom programmer?s model the eeprom module consists of two separately addressable sections. the first is an eight-byte memory mapped control register block used for control, testing and configuration of the eeprom array. the second section is the eeprom array itself. at reset, the eight-byte register section starts at address $00ec and the eeprom array is located from addresses $0800 to $0fff. registers $00ec-$00ed are reserved. read/write access to the memory array section can be enabled or disabled by the eeon control bit in the initee register ($0012). this feature allows the access of memory mapped resources that have lower priority than the eeprom memory array. eeprom control registers can be accessed regardless of the state of eeon. any eeprom erase or program operation already in progress will not be affected by the change of eeon state. for information on re-mapping the register block and eeprom address space, refer to operating modes . caution: it is strongly recommended to discontinue program/erase operations during wait (when eeswai=1) or stop modes since all program/erase activities will be terminated abruptly and considered unsuccessful. for lowest power consumption during wait mode, it is advised to turn off eepgm. the eeprom module contains an extra word called shadow word which is loaded at reset into the eemcr, eedivh and eedivl registers. to program the shadow word, when in special modes (smodn=0), the noshw bit in eemcr register must be cleared. normal programming routines are used to program the shadow word which becomes accessible at address $0fc0-$0fc1 when noshw is cleared. at the next reset the shadow word data is loaded into the eemcr, eedivh and eedivl registers. the shadow word can be protected from being programmed or erased by setting the shprot bit of eeprot register. 3-eeprom
eeprom mc68hc912dt128a rev 2.0 104 eeprom motorola a steady internal self-time clock is required to provide accurate counts to meet eeprom program/erase requirements. this clock is generated via by a programmable 10-bit prescaler register. automatic program/erase termination is also provided. in ordinary situations, with crystal operating properly, the steady internal self-time clock is derived from the input clock source (extali). the divider value is as in eedivh:eedivl. in limp-home mode, where the oscillator has malfunctioned or is unavailable, the self-time clock is derived from the pll at f vcomin (nominally 1 mhz), with a predefined divider value of $0023. program/erase operation is not guaranteed in limp-home mode. the clock switching function is only applicable for permanent loss of crystal condition, so the program/erase will also not be guaranteed when the loss of crystal condition is intermittent. it is strongly recommended that the clock monitor is enabled to ensure that the program/erase operation will be shutdown in the event of loss of crystal with a clock monitor reset, or switch to a limp-home mode clock. this will prevent unnecessary stress on the emulated eeprom during oscillator failure. 4-eeprom
eeprom eeprom control registers mc68hc912dt128a rev 2.0 motorola eeprom 105 eeprom control registers eediv[9:0] ? prescaler divider loaded from shadow word at reset. read anytime. write once in normal modes (smodn =1) if eelat = 0 and anytime in special modes (smodn =0) if eelat = 0. the prescaler divider is required to produce a self-time clock with a fixed frequency around 28.6 khz for the range of oscillator frequencies. the divider is set so that the oscillator frequency can be divided by a divide factor that can produce a 35 s 2 s timebase. caution: an incorrect or uninitialized value on eediv can result in overstress of eeprom array during program/erase operation. it is also strongly recommend not to program eeprom with oscillator frequencies less than 250 khz. the eediv value is determined by the following formula: eedivh ? eeprom modulus divider $00ee bit 7654321bit 0 000000eediv9eediv8 reset: 0 0 0 0 0 0 ? (1) ? (1) 1. loaded from shadow word. eedivl ? eeprom modulus divider $00ef bit 7654321bit 0 eediv7 eediv6 eediv5 eediv4 eediv3 eediv2 eediv1 eediv0 reset: ? (1) ? (1) ? (1) ? (1) ? (1) ? (1) ? (1) ? (1) 1. loaded from shadow word. eediv int extali (hz) x 35 6 ? [] 5-eeprom
eeprom mc68hc912dt128a rev 2.0 106 eeprom motorola note: int[a] denotes the round down integer value of a. program/erase cycles will not be activated when eediv = 0. bits[7:4] are loaded at reset from the eeprom shadow word. note: the bits 5 and 4 are reserved for test purposes. these locations in shadow word should not be programmed otherwise some locations of regular eeprom array will not be more visible. nobdml ? background debug mode lockout disable 0 = the bdm lockout is enabled. 1 = the bdm lockout is disabled. loaded from shadow word at reset. read anytime. write anytime in special modes (smodn=0). noshw ? shadow word disable 0 = the shadow word is enabled and accessible at address $0fc0-$0fc1. 1 = regular eeprom array at address $0fc0-$0fc1. loaded from shadow word at reset. read anytime. write anytime in special modes (smodn=0). table 17 eediv selection osc freq. osc period divide factor eediv 16 mhz 62.5ns 560 $0230 8 mhz 125ns 280 $0118 4 mhz 250ns 140 $008c 2 mhz 500ns 70 $0046 1 mhz 1 s 35 $0023 500 khz 2 s 18 $0012 250 khz 4 s 9 $0009 eemcr ? eeprom module configuration $00f0 bit 7654321bit 0 nobdml noshw reserved (1) 1 eeswai protlck dmy reset: ? (2) ? (2) ? (2) ? (2) 1100 1. bits 4 and 5 have test functions and should not be programmed. 2. loaded from shadow word. 6-eeprom
eeprom eeprom control registers mc68hc912dt128a rev 2.0 motorola eeprom 107 7-eeprom when noshw cleared, the regular eeprom array bytes at address $0fc0 and $0fc1 are not visible. the shadow word is accessed instead for both read and program/erase operations. bits[7:4] from the high byte of the shadow word, $0fc0, are loaded to eemcr[7:4]. bits[1:0] from the high byte of the shadow word, $0fc0,are loaded to eedivh[1:0]. bits[7:0] from the low byte of the shadow word, $0fc1,are loaded to eedivl[7:0]. bulk program/erase only applies if shadow word is enabled. note: bit 6 from high byte of shadow word should not be programmed in order to have the full eeprom array visible. eeswai ? eeprom stops in wait mode 0 = the module is not affected during wait mode 1 = the module ceases to be clocked during wait mode read and write anytime. note: the eeswai bit should be cleared if the wait mode vectors are mapped in the eeprom array. protlck ? block protect write lock 0 = block protect bits and bulk erase protection bit can be written 1 = block protect bits are locked read anytime. write once in normal modes (smodn = 1), set and clear any time in special modes (smodn = 0). dmy ? dummy bit read and write anytime.
eeprom mc68hc912dt128a rev 2.0 108 eeprom motorola prevents accidental writes to eeprom. read anytime. write anytime if eepgm = 0 and protlck = 0. shprot ? shadow word protection 0 = the shadow word can be programmed and erased. 1 = the shadow word is protected from being programmed and erased. bprot[5:0] ? eeprom block protection 0 = associated eeprom block can be programmed and erased. 1 = associated eeprom block is protected from being programmed and erased. in normal mode, writes to eetst control bits have no effect and always read zero. the eeprom module cannot be placed in test mode inadvertently during normal operation eeprot ? eeprom block protect $00f1 bit 7654321bit 0 shprot 1 bprot5 bprot4 bprot3 bprot2 bprot1 bprot0 reset: 1 1 1 1 1 1 1 1 table 18 2k byte eeprom block protection bit name block protected block size bprot5 $0800 to $0bff 1024 bytes bprot4 $0c00 to $0dff 512 bytes bprot3 $0e00 to $0eff 256 bytes bprot2 $0f00 to $0f7f 128 bytes bprot1 $0f80 to $0fbf 64 bytes bprot0 $0fc0 to $0fff 64 bytes eetst ? eeprom test $00f2 bit 7654321bit 0 0 erevtn 0 0 0 etmsd etmr etmse reset:00000000 8-eeprom
eeprom eeprom control registers mc68hc912dt128a rev 2.0 motorola eeprom 109 9-eeprom . bulkp ? bulk erase protection 0 = eeprom can be bulk erased. 1 = eeprom is protected from being bulk or row erased. read anytime. write anytime if eepgm = 0 and protlck = 0. auto ? automatic shutdown of program/erase operation. eepgm is cleared automatically after the program/erase cycles are finished when auto is set. 0 = automatic clear of eepgm is disabled. 1 = automatic clear of eepgm is enabled. read anytime. write anytime if eepgm = 0. byte ? byte and aligned word erase 0 = bulk or row erase is enabled. 1 = one byte or one aligned word erase only. read anytime. write anytime if eepgm = 0. row ? row or bulk erase (when byte = 0) 0 = erase entire eeprom array. 1 = erase only one 32-byte row. read anytime. write anytime if eepgm = 0. byte and row have no effect when erase = 0 if byte = 1 only the location specified by the address written to the programming latches will be erased. the operation will be a byte or an aligned word erase depending on the size of written data. eeprog ? eeprom control $00f3 bit 7654321bit 0 bulkp 0 auto byte row erase eelat eepgm reset:10000000 table 19 erase selection byte row block size 0 0 bulk erase entire eeprom array 0 1 row erase 32 bytes 1 0 byte or aligned word erase 1 1 byte or aligned word erase
eeprom mc68hc912dt128a rev 2.0 110 eeprom motorola erase ? erase control 0 = eeprom configuration for programming. 1 = eeprom configuration for erasure. read anytime. write anytime if eepgm = 0. configures the eeprom for erasure or programming. unless bulkp is set, erasure is by byte, aligned word, row or bulk. eelat ? eeprom latch control 0 = eeprom set up for normal reads. 1 = eeprom address and data bus latches set up for programming or erasing. read anytime. write anytime except when eepgm = 1 or eediv = 0. byte, row, erase and eelat bits can be written simultaneously or in any sequence. eepgm ? program and erase enable 0 = disables program/erase voltage to eeprom. 1 = applies program/erase voltage to eeprom. the eepgm bit can be set only after eelat has been set. when eelat and eepgm are set simultaneously, eepgm remains clear but eelat is set. the bulkp, auto, byte, row, erase and eelat bits cannot be changed when eepgm is set. to complete a program or erase cycle when auto bit is clear, two successive writes to clear eepgm and eelat bits are required before reading the programmed data. when auto bit is set, eepgm is automatically cleared after the program or erase cycle is over. a write to an eeprom location has no effect when eepgm is set. latched address and data cannot be modified during program or erase. 10-eeprom
eeprom program/erase operation mc68hc912dt128a rev 2.0 motorola eeprom 111 11-eeprom program/erase operation a program or erase operation should follow the sequence below if auto bit is clear: 1. write byte, row and erase to desired value, write eelat = 1 2. write a byte or an aligned word to an eeprom address 3. write eepgm = 1 4. wait for programming, t prog or erase, t erase delay time 5. write eepgm = 0 6. write eelat = 0 if the auto bit is set, steps 4 and 5 can be replaced by a step to poll the eepgm bit until it is cleared. caution: the state machine will not start if an attempt is made to program or erase a protected location and therefore the eepgm bit will never clear on that eeprom operation. check for protected status or use a software timeout to avoid a continuous loop whilst polling the eepgm bit. if using a timeout, ensure steps 5 and 6 are still executed. it is possible to program/erase more bytes or words without intermediate eeprom reads, by jumping from step 5 to step 2. shadow word mapping the shadow word is mapped to location $_fc0 and $_fc1 when the noshw bit in eemcr register is zero. the value in the shadow word is loaded to the eemcr, eedivh and eedivl after reset. table 20 shows the mapping of each bit from shadow word to the registers.
eeprom mc68hc912dt128a rev 2.0 112 eeprom motorola programming eedivh and eedivl registers the eedivh and eedivl registers must be correctly set according to the oscillator frequency before any eeprom location can be programmed or erased. normal mode the eedivh and eedivl registers are write once in normal mode. upon system reset, the application program is required to write the correct divider value to eedivh and eedivl registers based on the oscillator frequency. after the first write, the value in the eedivh and eedivl registers is locked from being overwritten until the next reset. the eeprom is then ready for standard program/erase routines. caution: runaway code can possibly corrupt the eedivh and eedivl registers if they are not initialized (write once registers). table 20 shadow word mapping shadow word location register / bit $_fc0 bit 7 eemcr / nobdml $_fc0, bit 6 eemcr / noshw $_fc0, bit 5 eemcr / bit 5 (1) 1. reserved for testing. must be set to one in user application. $_fc0, bit 4 eemcr / bit 4 (1) $_fc0, bit 3:2 not mapped (2)) 2. reserved. must be set to one in user application for future compatibility. $_fc0, bit 1:0 eedivh / bit 1:0 $_fc1, bit 7:0 eemcr / bit 7:0 12-eeprom
eeprom programming eedivh and eedivl registers mc68hc912dt128a rev 2.0 motorola eeprom 113 13-eeprom special mode if an existing application code with eeprom program/erase routines is fixed and the system is already operating at a known oscillator frequency, it is recommended to initialize the shadow word with the corresponding eedivh and eedivl values in special mode. the shadow word initializes eedivh and eedivl registers upon system reset to ensure software compatibility with existing code. initializing the eedivh and eedivl registers in special modes (smodn=0) is accomplished by the following steps. 1. write correct divider value to eedivh and eedivl registers based on the oscillator frequency as per table 17 . 2. remove the shadow word protection by clearing shprot bit in eeprot register. 3. clear noshw bit in eemcr register to make the shadow word visible at $0fc0-$0fc1. 4. write noshw bit in eemcr register to make the shadow word visible at $0fc0-$0fc1. 5. program bits 1 and 0 of the high byte of the shadow word and bits 7 to 0 of the low byte of the shadow word like a regular eeprom location at address $0fc0 and $0fc1. do not program other bits of the high byte of the shadow word (location $0fc0); otherwise some regular eeprom array locations will not be visible. at the next reset, the shadow values are loaded into the eedivh and eedivl registers. they do not require further initialization as long as the oscillator frequency of the target application is not changed. 6. protect the shadow word by setting shprot bit in eeprot register.
eeprom mc68hc912dt128a rev 2.0 114 eeprom motorola 14-eeprom
mc68hc912dt128a rev 2.0 motorola resets and interrupts 115 resets and interrupts resets and interrupts contents introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 exception priority . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 maskable interrupts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 latching of interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 interrupt control and priority registers. . . . . . . . . . . . . . . . . . . . . . . 119 interrupt test registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 resets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 effects of reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 register stacking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124 introduction cpu12 exceptions include resets and interrupts. each exception has an associated 16-bit vector, which points to the memory location where the routine that handles the exception is located. vectors are stored in the upper 128 bytes of the standard 64k byte address map. the six highest vector addresses are used for resets and non-maskable interrupt sources. the remainder of the vectors are used for maskable interrupts, and all must be initialized to point to the address of the appropriate service routine. 1-reset
resets and interrupts mc68hc912dt128a rev 2.0 116 resets and interrupts motorola exception priority a hardware priority hierarchy determines which reset or interrupt is serviced first when simultaneous requests are made. six sources are not maskable. the remaining sources are maskable, and any one of them can be given priority over other maskable interrupts. the priorities of the non-maskable sources are: 1. por or reset pin 2. clock monitor reset 3. cop watchdog reset 4. unimplemented instruction trap 5. software interrupt instruction (swi) 6. xirq signal (if x bit in ccr = 0) maskable interrupts maskable interrupt sources include on-chip peripheral systems and external interrupt service requests. interrupts from these sources are recognized when the global interrupt mask bit (i) in the ccr is cleared. the default state of the i bit out of reset is one, but it can be written at any time. interrupt sources are prioritized by default but any one maskable interrupt source may be assigned the highest priority by means of the hprio register. the relative priorities of the other sources remain the same. an interrupt that is assigned highest priority is still subject to global masking by the i bit in the ccr, or by any associated local bits. interrupt vectors are not affected by priority assignment. hprio can only be written while the i bit is set (interrupts inhibited). table 21 lists interrupt sources and vectors in default order of priority. before masking an interrupt by clearing the corresponding local enable bit, it is required to set the i-bit to avoid an swi. 2--reset
resets and interrupts latching of interrupts mc68hc912dt128a rev 2.0 motorola resets and interrupts 117 latching of interrupts xirq is always level triggered and irq can be selected as a level triggered interrupt. these level triggered interrupt pins should only be released during the appropriate interrupt service routine. generally the interrupt service routine will handshake with the interrupting logic to release the pin. in this way, the mcu will never start the interrupt service sequence only to determine that there is no longer an interrupt source. in event that this does occur the trap vector will be taken. if irq is selected as an edge triggered interrupt, the hold time of the level after the active edge is independent of when the interrupt is serviced. as long as the minimum hold time is met, the interrupt will be latched inside the mcu. in this case the irq edge interrupt latch is cleared automatically when the interrupt is serviced. all of the remaining interrupts are latched by the mcu with a flag bit. these interrupt flags should be cleared during an interrupt service routine or when interrupts are masked by the i bit. by doing this, the mcu will never get an unknown interrupt source and take the trap vector. 3-reset
resets and interrupts mc68hc912dt128a rev 2.0 118 resets and interrupts motorola table 21 interrupt vector map vector address interrupt source ccr mask local enable hprio value to elevate $fffe, $ffff reset none none ? $fffc, $fffd clock monitor fail reset none copctl (cme, fcme) ? $fffa, $fffb cop failure reset none cop rate selected ? $fff8, $fff9 unimplemented instruction trap none none ? $fff6, $fff7 swi none none ? $fff4, $fff5 xirq x bit none ? $fff2, $fff3 irq i bit intcr (irqen) $f2 $fff0, $fff1 real time interrupt i bit rtictl (rtie) $f0 $ffee, $ffef timer channel 0 i bit tmsk1 (c0i) $ee $ffec, $ffed timer channel 1 i bit tmsk1 (c1i) $ec $ffea, $ffeb timer channel 2 i bit tmsk1 (c2i) $ea $ffe8, $ffe9 timer channel 3 i bit tmsk1 (c3i) $e8 $ffe6, $ffe7 timer channel 4 i bit tmsk1 (c4i) $e6 $ffe4, $ffe5 timer channel 5 i bit tmsk1 (c5i) $e4 $ffe2, $ffe3 timer channel 6 i bit tmsk1 (c6i) $e2 $ffe0, $ffe1 timer channel 7 i bit tmsk1 (c7i) $e0 $ffde, $ffdf timer overflow i bit tmsk2 (toi) $de $ffdc, $ffdd pulse accumulator overflow i bit pactl (paovi) $dc $ffda, $ffdb pulse accumulator input edge i bit pactl (pai) $da $ffd8, $ffd9 spi serial transfer complete i bit sp0cr1 (spie) $d8 $ffd6, $ffd7 sci 0 i bit sc0cr2 (tie, tcie, rie, ilie) $d6 $ffd4, $ffd5 sci 1 i bit sc1cr2 (tie, tcie, rie, ilie) $d4 $ffd2, $ffd3 atd0 or atd1 i bit atdxctl2 (ascie) $d2 $ffd0, $ffd1 mscan 0 wake-up i bit c0rier (wupie) $d0 $ffce, $ffcf key wake-up j or h i bit kwiej[7:0] and kwieh[7:0] $ce $ffcc, $ffcd modulus down counter underflow i bit mcctl (mczi) $cc $ffca, $ffcb pulse accumulator b overflow i bit pbctl (pbovi) $ca $ffc8, $ffc9 mscan 0 errors i bit c0rier (rwrnie, twrnie, rerrie, terrie, boffie, ovrie) $c8 $ffc6, $ffc7 mscan 0 receive i bit c0rier (rxfie) $c6 $ffc4, $ffc5 mscan 0 transmit i bit c0tcr (txeie[2:0]) $c4 $ffc2, $ffc3 cgm lock and limp home i bit pllcr (lockie, lhie) $c2 $ffc0, $ffc1 iic bus i bit ibcr (ibie) $c0 $ffbe, $ffbf mscan 1 wake-up i bit c1rier (wupie) $be 4-reset
resets and interrupts interrupt control and priority registers mc68hc912dt128a rev 2.0 motorola resets and interrupts 119 interrupt control and priority registers irqe ? irq select edge sensitive only 0 = irq configured for low-level recognition. 1 = irq configured to respond only to falling edges (on pin pe1/ irq ). irqe can be read anytime and written once in normal modes. in special modes, irqe can be read anytime and written anytime, except the first write is ignored. irqen ? external irq enable the irq pin has an internal pull-up. 0 = external irq pin is disconnected from interrupt logic. 1 = external irq pin is connected to interrupt logic. irqen can be read and written anytime in all modes. $ffbc, $ffbd mscan 1 errors i bit c1rier (rwrnie, twrnie, rerrie, terrie, boffie, ovrie) $bc $ffba, $ffbb mscan 1 receive i bit c1rier (rxfie) $ba $ffb8, $ffb9 mscan 1 transmit i bit c1tcr (txeie[2:0]) $b8 $ffb6, $ffb7 (1) mscan 2 wake-up i bit c2rier (wupie) $b6 $ffb4, $ffb5 (1) mscan 2 errors i bit c2rier (rwrnie, twrnie, rerrie, terrie, boffie, ovrie) $b4 $ffb2, $ffb3 (1) mscan 2 receive i bit c2rier (rxfie) $b2 $ffb0, $ffb1 (1) mscan 2 transmit i bit c2tcr (txeie[2:0]) $b0 $ff80 ? $ffaf reserved i bit $80 ? $ae 1. mc68hc912dt128a only intcr ? interrupt control register $001e bit 7654321bit 0 irqeirqendly00000 reset: 0 1 1 0 0 0 0 0 table 21 interrupt vector map vector address interrupt source ccr mask local enable hprio value to elevate 5-reset
resets and interrupts mc68hc912dt128a rev 2.0 120 resets and interrupts motorola dly ? enable oscillator start-up delay on exit from stop the delay time of about 4096 cycles is based on the xclk rate chosen. 0 = no stabilization delay imposed on exit from stop mode. a stable external oscillator must be supplied. 1 = stabilization delay is imposed before processing resumes after stop. dly can be read anytime and written once in normal modes. in special modes, dly can be read and written anytime. write only if i mask in ccr = 1 (interrupts inhibited). read anytime. to give a maskable interrupt source highest priority, write the low byte of the vector address to the hprio register. for example, writing $f0 to hprio would assign highest maskable interrupt priority to the real-time interrupt timer ($fff0). if an un-implemented vector address or a non-i-masked vector address (value higher than $f2) is written, then irq will be the default highest priority interrupt. interrupt test registers these registers are used in special modes for testing the interrupt logic and priority without needing to know which modules and what functions are used to generate the interrupts.each bit is used to force a specific interrupt vector by writing it to 1.bits are named with b6 through f4 to indicate vectors $ffb6 through $fff4. these bits are also used in special modes to view that an interrupt caused by a module has reached the interrupt module. hprio ? highest priority i interrupt $001f bit 7654321bit 0 1 psel6 psel5 psel4 psel3 psel2 psel1 0 reset: 1 1110010 6-reset
resets and interrupts resets mc68hc912dt128a rev 2.0 motorola resets and interrupts 121 7-reset these registers can only be read in special modes (read in normal mode will return $00). reading these registers at the same time as the interrupt is changing will cause an indeterminate value to be read. these registers can only be written in special mode. resets there are four possible sources of reset. power-on reset (por), and external reset on the reset pin share the normal reset vector. the computer operating properly (cop) reset and the clock monitor reset each has a vector. entry into reset is asynchronous and does not require a clock but the mcu cannot sequence out of reset without a system clock. power-on reset a positive transition on v dd causes a power-on reset (por). an external voltage level detector, or other external reset circuits, are the usual source of reset in a system. the por circuit only initializes internal itst0 ? interrupt test register 0 $0018 bit 7654321bit 0 ite6 ite8 itea itec itee itf0 itf2 itf4 reset: 0 0 0 0 0 0 0 0 itst1 ? interrupt test register 1 $0019 bit 7654321bit 0 itd6 itd8 itda itdc itde ite0 ite2 ite4 reset: 0 0000000 itst2 ? interrupt test register 2 $001a bit 7654321bit 0 itc6 itc8 itca itcc itce itd0 itd2 itd4 reset: 0 0 0 00000 itst3 ? interrupt test register 3 $001b bit 7654321bit 0 itb6 itb8 itba itbc itbe itc0 itc2 itc4 reset: 0 0 0 0 0 0 0 0
resets and interrupts mc68hc912dt128a rev 2.0 122 resets and interrupts motorola circuitry during cold starts and cannot be used to force a reset as system voltage drops. it is important to use an external low voltage reset circuit (for example: mc34064 or mc33464) to prevent power transitions or corruption of ram or eeprom. external reset the cpu distinguishes between internal and external reset conditions by sensing whether the reset pin rises to a logic one in less than nine e-clock cycles after an internal device releases reset. when a reset condition is sensed, an internal circuit drives the reset pin low and a clocked reset sequence controls when the mcu can begin normal processing. in the case of a clock monitor error, a 4096 cycle oscillator start-up delay is imposed before the reset recovery sequence starts (reset is driven low throughout this 4096 cycle delay). the internal reset recovery sequence then drives reset low for 16 to 17 cycles and releases the drive to allow reset to rise. nine e-clock cycles later the reset pin is sampled. if the pin is still held low, the cpu assumes that an external reset has occurred. if the pin is high, it indicates that the reset was initiated internally by either the cop system or the clock monitor. to prevent a cop reset from being detected during an external reset, hold the reset pin low for at least 32 cycles. to prevent a clock monitor reset from being detected during an external reset, hold the reset pin low for at least 4096 + 32 cycles. an external rc power-up delay circuit on the reset pin is not recommended ? circuit charge time can cause the mcu to misinterpret the type of reset that has occurred. cop reset the mcu includes a computer operating properly (cop) system to help protect against software failures. when cop is enabled, software must write $55 and $aa (in this order) to the coprst register in order to keep a watchdog timer from timing out. other instructions may be executed between these writes. a write of any value other than $55 or $aa or software failing to execute the sequence properly causes a cop reset to occur. in addition, windowed cop operation can be selected. in this mode, a write to the coprst register must occur in the last 25% of the selected period. a premature write will also reset the part. 8-reset
resets and interrupts effects of reset mc68hc912dt128a rev 2.0 motorola resets and interrupts 123 9-reset clock monitor reset if clock frequency falls below a predetermined limit when the clock monitor is enabled, a reset occurs. effects of reset when a reset occurs, mcu registers and control bits are changed to known start-up states, as follows. operating mode and memory map operating mode and default memory mapping are determined by the states of the bkgd, moda, and modb pins during reset. the smodn, moda, and modb bits in the mode register reflect the status of the mode-select inputs at the rising edge of reset. operating mode and default maps can subsequently be changed according to strictly defined rules. clock and watchdog control logic the cop watchdog system is enabled, with the cr[2:0] bits set for the longest duration time-out. the clock monitor is disabled. the rtif flag is cleared and automatic hardware interrupts are masked. the rate control bits are cleared, and must be initialized before the rti system is used. the dly control bit is set to specify an oscillator start-up delay upon recovery from stop mode. interrupts psel is initialized in the hprio register with the value $f2, causing the external irq pin to have the highest i-bit interrupt priority. the irq pin is configured for level-sensitive operation (for wired-or systems). however, the interrupt mask bits in the cpu12 ccr are set to mask x- and i-related interrupt requests. parallel i/o if the mcu comes out of reset in a single-chip mode, all ports are configured as general-purpose high-impedance inputs. if the mcu comes out of reset in an expanded mode, port a and port b are used for the address/data bus, and port e pins are normally used to control the external bus (operation of port e pins can be affected by the
resets and interrupts mc68hc912dt128a rev 2.0 124 resets and interrupts motorola pear register). out of reset, port j, port h, port k, port ib, port p, port s, port t, port ad0 and port ad1 are all configured as general-purpose inputs. central processing unit after reset, the cpu fetches a vector from the appropriate address, then begins executing instructions. the stack pointer and other cpu registers are indeterminate immediately after reset. the ccr x and i interrupt mask bits are set to mask any interrupt requests. the s bit is also set to inhibit the stop instruction. memory after reset, the internal register block is located from $0000 to $03ff, ram is at $2000 to $3fff, and eeprom is located at $0800 to $0fff. in single chip mode one 32-kbyte flash eeprom module is located from $4000 to $7fff and $c000 to $ffff, and the other three 32-kbyte flash eeprom modules are accessible through the program page window located from $8000 to $bfff. the first 32-kbyte flash eeprom is also accessible through the program page window. other resources the enhanced capture timer (ect), pulse width modulation timer (pwm), serial communications interfaces (sci0 and sci1), serial peripheral interface (spi), inter-ic bus (iic), motorola scalable cans (mscan0 and mscan1) and analog-to-digital converters (atd0 and atd1) are off after reset. register stacking once enabled, an interrupt request can be recognized at any time after the i bit in the ccr is cleared. when an interrupt service request is recognized, the cpu responds at the completion of the instruction being executed. interrupt latency varies according to the number of cycles required to complete the instruction. some of the longer instructions can be interrupted and will resume normally after servicing the interrupt. 10-reset
resets and interrupts register stacking mc68hc912dt128a rev 2.0 motorola resets and interrupts 125 11-reset when the cpu begins to service an interrupt, the instruction queue is cleared, the return address is calculated, and then it and the contents of the cpu registers are stacked as shown in table 22 . after the ccr is stacked, the i bit (and the x bit, if an xirq interrupt service request is pending) is set to prevent other interrupts from disrupting the interrupt service routine. the interrupt vector for the highest priority source that was pending at the beginning of the interrupt sequence is fetched, and execution continues at the referenced location. at the end of the interrupt service routine, an rti instruction restores the content of all registers from information on the stack, and normal program execution resumes. if another interrupt is pending at the end of an interrupt service routine, the register unstacking and restacking is bypassed and the vector of the interrupt is fetched. table 22 stacking order on entry to interrupts memory location cpu registers sp ? 2rtn h : rtn l sp ? 4y h : y l sp ? 6x h : x l sp ? 8 b : a sp ? 9 ccr
resets and interrupts mc68hc912dt128a rev 2.0 126 resets and interrupts motorola 12-reset
mc68hc912dt128a rev 2.0 motorola i/o ports with key wake-up 127 i/o ports with key wake-up i/o ports with key wake-up contents introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 key wake-up and port registers . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 key wake-up input filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 introduction the offers 16 additional i/o ports with key wake-up capability. the key wake-up feature of the mc68hc912dt128a issues an interrupt that will wake up the cpu when it is in the stop or wait mode. two ports are associated with the key wake-up function: port h and port j. port h and port j wake-ups are triggered with a either a rising or falling signal edge. for each pin which has an interrupt enabled, there is a path to the interrupt request signal which has no clocked devices when the part is in stop mode. this allows an active edge to bring the part out of stop. digital filtering is included to prevent pulses shorter than a specified value from waking the part from stop. an interrupt is generated when a bit in the kwifh or kwifj register and its corresponding kwieh or kwiej bit are both set. all 16 bits/pins share the same interrupt vector. key wake-ups can be used with the pins configured as inputs or outputs. default register addresses, as established after reset, are indicated in the following descriptions. for information on re-mapping the register block, refer to operating modes . 1-kwu
i/o ports with key wake-up mc68hc912dt128a rev 2.0 128 i/o ports with key wake-up motorola key wake-up and port registers read and write anytime. read and write anytime. data direction register j is associated with port j and designates each pin as an input or output. read and write anytime ddrj[7:0] ? data direction port j 0 = associated pin is an input 1 = associated pin is an output portj ? port j register $0028 bit 7654321bit 0 portpj7pj6pj5pj4pj3pj2pj1pj0 kwu kwj7 kwj6 kwj5 kwj4 kwj3 kwj2 kwj1 kwj0 reset: - - - - - - - - porth ? port h register $0029 bit 7654321bit 0 ph7 ph6 ph5 ph4 ph3 ph2 ph1 ph0 kwu kwh7 kwh6 kwh5 kwh4 kwh3 kwh2 kwh1 kwh0 reset: - - ------ ddrj ? port j data direction register $002a bit 7654321bit 0 ddj7 ddj6 ddj5 ddj4 ddj3 ddj2 ddj1 ddj0 reset: 0 0000000 2--kwu
i/o ports with key wake-up key wake-up and port registers mc68hc912dt128a rev 2.0 motorola i/o ports with key wake-up 129 data direction register h is associated with port h and designates each pin as an input or output. read and write anytime. ddrh[7:0] ? data direction port h 0 = associated pin is an input 1 = associated pin is an output read and write anytime. kwiej[7:0] ? key wake-up port j interrupt enables 0 = interrupt for the associated bit is disabled 1 = interrupt for the associated bit is enabled read and write anytime. kwieh[7:0] ? key wake-up port h interrupt enables 0 = interrupt for the associated bit is disabled 1 = interrupt for the associated bit is enabled ddrh ? port h data direction register $002b bit 7654321bit 0 ddh7 ddh6 ddh5 ddh4 ddh3 ddh2 ddh1 ddh0 reset: 0 0000000 kwiej ? key wake-up port j interrupt enable register $002c bit 7654321bit 0 kwiej7 kwiej6 kwiej5 kwiej4 kwiej3 kwiej2 kwiej1 kwiej0 reset: 0 0000000 kwieh ? key wake-up port h interrupt enable register $002d bit 7654321bit 0 kwieh7 kwieh6 kwieh5 kwieh4 kwieh3 kwieh2 kwieh1 kwieh0 reset: 0 0 0 00000 3-kwu
i/o ports with key wake-up mc68hc912dt128a rev 2.0 130 i/o ports with key wake-up motorola read and write anytime. each flag is set by an active edge on its associated input pin. this could be a rising or falling edge based on the state of the kwpj register. to clear the flag, write one to the corresponding bit in kwifj. initialize this register after initializing kwpj so that illegal flags can be cleared. kwifj[7:0] ? key wake-up port j flags 0 = active edge on the associated bit has not occurred 1 = active edge on the associated bit has occurred (an interrupt will occur if the associated enable bit is set). read and write anytime. each flag is set by an active edge on its associated input pin. this could be a rising or falling edge based on the state of the kwph register. to clear the flag, write one to the corresponding bit in kwifh. initialize this register after initializing kwph so that illegal flags can be cleared. kwifh[7:0] ? key wake-up port h flags 0 = active edge on the associated bit has not occurred 1 = active edge on the associated bit has occurred (an interrupt will occur if the associated enable bit is set) kwifj ? key wake-up port j flag register $002e bit 7654321bit 0 kwifj7 kwifj6 kwifj5 kwifj4 kwifj3 kwifj2 kwifj1 kwifj0 reset: 00000000 kwifh ? key wake-up port h flag register $002f bit 7654321bit 0 kwifh7 kwifh6 kwifh5 kwifh4 kwifh3 kwifh2 kwifh1 kwifh0 reset: 00000000 4-kwu
i/o ports with key wake-up key wake-up and port registers mc68hc912dt128a rev 2.0 motorola i/o ports with key wake-up 131 read and write anytime. it is best to clear the flags after initializing this register because changing the polarity of a bit can cause the associated flag to become set. kwpj[7:0] ? key wake-up port j polarity selects 0 = falling edge on the associated port j pin sets the associated flag bit in the kwifj register and a resistive pull-up device is connected to associated port j input pin. 1 = rising edge on the associated port j pin sets the associated flag bit in the kwifj register and a resistive pull-down device is connected to associated port j input pin. read and write anytime. it is best to clear the flags after initializing this register because changing the polarity of a bit can cause the associated flag to become set. kwph[7:0] ? key wake-up port h polarity selects 0 = falling edge on the associated port h pin sets the associated flag bit in the kwifh register and a resistive pull-up device is connected to associated port h input pin. 1 = rising edge on the associated port h pin sets the associated flag bit in the kwifh register and a resistive pull-down device is connected to associated port h input pin. kwpj ? key wake-up port j polarity register $0030 bit 7654321bit 0 kwpj7 kwpj6 kwpj5 kwpj4 kwpj3 kwpj2 kwpj1 kwpj0 reset: 0 0 0 00000 kwph ? key wake-up port h polarity register $0031 bit 7654321bit 0 kwph7 kwph6 kwph5 kwph4 kwph3 kwph2 kwph1 kwph0 reset: 00000000 5-kwu
i/o ports with key wake-up mc68hc912dt128a rev 2.0 132 i/o ports with key wake-up motorola key wake-up input filter the kwu input signals are filtered by a digital filter which is active only during stop mode. the purpose of the filter is to prevent single pulses shorter than a specified value from waking the part from stop. the filter is composed of an internal oscillator and a majority voting logic. the filter oscillator starts the oscillation by detecting a triggering edge on an input if the corresponding interrupt enable bit is set. the majority voting logic takes three samples of an asserted input pin at each filter oscillator period and if two samples are taken at the triggering level, the filter recognizes a valid triggering level and sets the corresponding interrupt flag. in this way the majority voting logic rejects the short non-triggering state between two incoming triggering pulses. as the filter is shared with all kwu inputs, the filter considers any pulse coming from any input pin for which the corresponding interrupt enable bit is set. the timing specification is given for a single pulse. the time interval between the triggering edges of two following pulses should be greater than the tkwsp in order to be considered as a single pulse by the filter. if this time interval is shorter than tkwsp, the majority voting logic may treat the two consecutive pulses as a single valid pulse. the filter is shared by all the kwu pins. hence any valid triggering level on any kwu pin is seen by the filter. the timing specification applies to the input of the filter. 6-kwu
i/o ports with key wake-up key wake-up input filter mc68hc912dt128a rev 2.0 motorola i/o ports with key wake-up 133 7-kwu figure 12 stop key wake-up filter glitch, filtered out, no stop wake-up valid stop wake-up pulse t kwstp min. t kwsp minimum time interval between pulses to be recognized as single pulses t kwstp max.
i/o ports with key wake-up mc68hc912dt128a rev 2.0 134 i/o ports with key wake-up motorola 8-kwu
mc68hc912dt128a rev 2.0 motorola clock functions 135 clock functions clock functions contents introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 clock sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136 phase-locked loop (pll) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 acquisition and tracking modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 limp-home and fast stop recovery modes . . . . . . . . . . . . . . . . . 141 system clock frequency formulae . . . . . . . . . . . . . . . . . . . . . . . . . 159 clock divider chains. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160 computer operating properly (cop) . . . . . . . . . . . . . . . . . . . . . . . . 163 real-time interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164 clock monitor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164 clock function registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 introduction clock generation circuitry generates the internal and external e-clock signals as well as internal clock signals used by the cpu and on-chip peripherals. a clock monitor circuit, a computer operating properly (cop) watchdog circuit, and a periodic interrupt circuit are also incorporated into the mc68hc912dt128a. 1-clock
clock functions mc68hc912dt128a rev 2.0 136 clock functions motorola clock sources a compatible external clock signal can be applied to the extal pin or the mcu can generate a clock signal using an on-chip oscillator circuit and an external crystal or ceramic resonator. the mcu uses several types of internal clock signals derived from the primary clock signal: txclk clocks are used by the cpu. eclk and pclk are used by the bus interfaces, spi, pwm, atd0 and atd1. mclk is either pclk or xclk, and drives on-chip modules such as sci0, sci1 and ect. xclk drives on-chip modules such as rti, cop and restart-from-stop delay time. slwclk is used as a calibration output signal. the mscan module is clocked by extali or sysclk, under control of an mscan bit. the clock monitor is clocked by extali. the bdm system is clocked by bclk or eclk, under control of a bdm bit. a slow mode clock divider is included to deliver a lower clock frequency for the sci baud rate generators, the ect timer module, and the rti and cop clocks. the slow clock bus frequencies divide the crystal frequency in a programmable range of 4 to 252, with steps of 4. this is very useful for low power operation. see the clock divider chains section for further details. figure 13 shows some of the timing relationships. 2--clock
clock functions phase-locked loop (pll) mc68hc912dt128a rev 2.0 motorola clock functions 137 figure 13 internal clock relationships phase-locked loop (pll) the phase-locked loop (pll) of the 68hc912d60a is designed for robust operation in an automotive environment. the proposed pll crystal or ceramic resonator reference of 0.5 to 8mhz is selected for the wide availability of components with good stability in the desired temperature range. please refer to figure 18 in section clock divider chains for an overview of system clocks. an oscillator design with reduced power consumption allows for slow wait operation with a typical power supply current lower than a milli-ampere. the pll circuitry can be bypassed when the vddpll supply is at vss level. in this case the oscillator output transistor has a stronger transconductance, for a crystal at twice the bus frequency. refer to figure 7 in pinout and signal descriptions . t1clk t2clk t3clk t4clk int eclk pclk xclk canclk 3-clock
clock functions mc68hc912dt128a rev 2.0 138 clock functions motorola figure 14 pll functional diagram the pll may be used to run the mcu from a different time base than the incoming crystal value. it creates an integer multiple of a reference frequency. for increased flexibility, the crystal clock can be divided by values in a range of 1 ? 8 (in unit steps) to generate the reference frequency. the pll can multiply this reference clock in a range of 1 to 64. although it is possible to set the divider to command a very high clock frequency, do not exceed the specified bus frequency limit for the mcu. if the pll is selected, it will continue to run when in wait mode resulting in more power consumption than normal. to take full advantage of the reduced power consumption of wait mode, turn off the pll before going into wait. please note that in this case the pll stabilization time applies. the pll operation is suspended in stop mode. after stop exit followed by the stabilization time, it resumes operation at the same frequency, provided the auto bit is set. a passive external loop filter must be placed on the control line (xfc pad). the filter is a second-order, low-pass filter to eliminate the vco input ripple. values of components in the diagram are dependent upon the desired vco operation. see xfc description. reduced consumption oscillator extal xtal extali pllclk reference programmable divider pdet phase detector refdv <2:0> loop programmable divider syn <5:0> cpump vco lock loop filter xfc pad up down lock detector refclk divclk slow mode programmable clock divider sldv <5:0> xclk extali 2 slwclk vddpll 2 4-clock
clock functions acquisition and tracking modes mc68hc912dt128a rev 2.0 motorola clock functions 139 acquisition and tracking modes the lock detector compares the frequencies of the vco feedback clock, divclk, and the final reference clock, refclk. therefore, the speed of the lock detector is directly proportional to the final reference frequency. the circuit determines the mode of the pll and the lock condition based on this comparison. the pll filter is manually or automatically configurable into one of two operating modes:  acquisition mode ? in acquisition mode, the filter can make large frequency corrections to the vco. this mode is used at pll start-up or when the pll has suffered a severe noise hit and the vco frequency is far off the desired frequency. this mode can also be desired in harsh environments when the leakage levels on the filter pin (xfc) can overcome the tracking currents of the pll charge pump. when in acquisition mode, the acq bit in the pll control register is clear.  tracking mode ? in tracking mode, the filter makes only small corrections to the frequency of the vco. the pll enters tracking mode when the vco frequency is nearly correct. the pll is automatically in tracking mode when not in acquisition mode or when the acq bit is set. the pll can change the bandwidth or operational mode of the loop filter manually or automatically. with an identical filtering time constant, the pll bandwidth is larger in acquisition mode than in tracking by a ratio of about 3. in automatic bandwidth control mode (auto = 1), the lock detector automatically switches between acquisition and tracking modes. automatic bandwidth control mode also is used to determine when the vco clock, pllclk, is safe to use as the source for the base clock, sysclk. if pll lock interrupt requests are enabled, the software can wait for an interrupt request and then check the lock bit. if cpu interrupts are disabled, software can poll the lock bit continuously (during pll start-up, usually) or at periodic intervals. in either case, when the lock bit is set, the pllclk clock is safe to use as the source 5-clock
clock functions mc68hc912dt128a rev 2.0 140 clock functions motorola for the base clock. see clock divider chains . if the vco is selected as the source for the base clock and the lock bit is clear, the pll has suffered a severe noise hit and the software must take appropriate action, depending on the application. the following conditions apply when the pll is in automatic bandwidth control mode:  the acq bit is a read-only indicator of the mode of the filter.  the acq bit is set when the vco frequency is within a certain tolerance, ? trk , and is cleared when the vco frequency is out of a certain tolerance, ? unt . see 19 electrical characteristics.  the lock bit is a read-only indicator of the locked state of the pll.  the lock bit is set when the vco frequency is within a certain tolerance, ? lock , and is cleared when the vco frequency is out of a certain tolerance, ? unl . see 19 electrical characteristics.  cpu interrupts can occur if enabled (lockie = 1) when the lock condition changes, toggling the lock bit. the pll also can operate in manual mode (auto = 0). all lock features described above are active in this mode, only the bandwidth control is disabled. manual mode is used mainly for systems operating under harsh conditions (e.g.uncoated pcbs in automotive environments). when this is the case, the pll is likely to remain in acquisition mode. the following conditions apply when in manual mode:  acq is a writable control bit that controls the mode of the filter. before turning on the pll in manual mode, the acq bit must be clear.  in case tracking is desired (acq = 1), the software must wait a given time, tacq, after turning on the pll by setting pllon in the pll control register. this is to avoid switching to tracking mode too early while the xfc voltage level is still too far away from its quiescent value corresponding to the target frequency. this operation would be very detrimental to the stabilization time. 6-clock
clock functions limp-home and fast stop recovery modes mc68hc912dt128a rev 2.0 motorola clock functions 141 7-clock limp-home and fast stop recovery modes if the crystal frequency is not available due to a crystal failure or a long crystal start-up time, the mcu system clock can be supplied by the vco at its minimum operating frequency, f vcomin . this mode of operation is called limp-home mode and is only available when the vddpll supply voltage is at vdd level (i.e. power supply for the pll module is present). upon power-up, the ability of the system to start in limp-home mode is restricted to normal mcu modes only. the clock monitor circuit (see section clock monitor) can detect the loss of extali, the external clock input signal, regardless of whether this signal is used as the source for mcu clocks or as the pll reference clock. the clock monitor control bits, cme and fcme, are used to enable or disable external clock detection. a missing external clock may occur in the three following instances:  during normal clock operation.  at power-on reset.  in the stop exit sequence clock loss during normal operation the ? no limp-home mode ? bit, nolhm, determines how the mcu responds to an external clock loss in this case. with limp home mode disabled (nolhm bit set) and the clock monitor enabled (cme or fcme bits set), on a loss of clock the mcu is reset via the clock monitor reset vector. this is the same behavior as standard m68hc12 circuits without pll or operation with vddpll at vss level. with limp home mode enabled (nolhm bit cleared) and the clock monitor enabled (cme or fcme bits set), on a loss of clock, the pll vco clock at its minimum frequency, f vcomin , is provided as the system clock, allowing the mcu to continue operating. the mcu is said to be operating in ?limp-home? mode with the forced vco clock as the system clock. pllon and bcsp ( ? bus clock select pll ? ) signals are forced high and the mcs ( ? module clock select ? ) signal
clock functions mc68hc912dt128a rev 2.0 142 clock functions motorola is forced low. the lhome flag in the pllflg register is set to indicate that the mcu is running in limp-home mode. a change of this flag sets the limp-home interrupt flag, lhif, and if enabled by the lhie bit, the limp-home mode interrupt is requested. the clock monitor is enabled irrespective of cme and fcme bit settings. module clocks to the rti & cop (xclk), bdm (bclk) and ect & sci (mclk) are forced to be pclk (at f vcomin ) and eclk is also equal to f vcomin . mscan clock select is unaffected. figure 15 clock loss during normal operation the clock monitor is polled each time the 13-stage free running counter reaches a count of 4096 xclk cycles i.e. mid-count, hence the clock status gets checked once every 8192 xclk cycles. when the presence of an external clock is detected, the mcu exits limp-home mode, clearing the lhome flag and setting the limp-home interrupt flag. upon leaving limp-home mode, bcsp and mcs signals are restored to their values before the clock loss. all clocks return to their normal settings and clock monitor control is returned to the cme & fcme bits. if auto and bcsp bits were set before the clock loss (selecting the pll to provide a system clock) the sysclk ramps-up and the pll locks at the previously selected frequency. to prevent pll operation when the external clock 0 --> 4096 limp-home (clocked by xclk) bcsp restore bcsp sysclk pllclk (limp-home) restore pllclk or extali extali 13-stage counter clock monitor fail 0 --> 4096 ab 8-clock
clock functions limp-home and fast stop recovery modes mc68hc912dt128a rev 2.0 motorola clock functions 143 9-clock frequency comes back, software should clear the bcsp bit while running in limp-home mode. the two shaded regions a and b in figure 15 present a of code run away due to incorrect clocks on sysclk if the mcu is clocked by extali and the pll is not used. in region a , there is a delay between the loss of clock and its detection by the clock monitor. when the extali clock signal is disturbed, the clock generation circuitry may receive an out of spec signal and drive the cpu with irregular clocks. this may lead to code runaway. in region b , as the 13-stage counter is free running, the count of 4096 may be reached when the amplitude of the extali clock has not stabilized. in this case, an improper extali is sent to the clock generation circuitry when limp-home mode is exited. this may also cause code runaway. if the mcu is clocked by the pll, the risk of code runaway is very low, but it can still occur under certain conditions due to irregular clocks from the clock source appearing on the sysclk. caution: the cop watch dog should always be enabled in order to reset the mcu in case of a code runaway situation. note: it is always advisable to take additional precautions within the application software to trap such situations.
clock functions mc68hc912dt128a rev 2.0 144 clock functions motorola no clock at power-on reset the voltage level on vddpll determines how the mcu responds to an external clock loss in this case. with the vddpll supply voltage at vdd level, any reset sets the clock monitor enable bit (cme) and the pllon bit and clears the nolhm bit. therefore, if the mcu is powered up without an external clock, limp-home mode is entered provided the mcu is in a normal mode of operation. figure 16 no clock at power-on reset vdd power-on detector clock monitor fail extali 13-stage counter internal reset 0 --> 4096 limp-home (clocked by xclk) bcsp reset: bcsp = 0 sysclk pllclk (l.h.) extali sysclk pllclk (software check of limp-home flag) extali (slow extali) 0 --> 4096 (slow extali) 10-clock
clock functions limp-home and fast stop recovery modes mc68hc912dt128a rev 2.0 motorola clock functions 145 11-clock during this power up sequence, after the por pulse falling edge, the vco supplies the limp-home clock frequency to the 13-stage counter, as the bcsp output is forced high and mcs is forced low. xclk, bclk and mclk are forced to be pclk, which is supplied by the vco at f vcomin . the initial period taken for the 13-stage counter to reach 4096 defines the internal reset period. if the clock monitor indicates the presence of an external clock during the internal reset period, limp-home mode is de-asserted and the 13-stage counter is then driven by extali clock. after the 13-stage counter reaches a count of 4096 xclk cycles, the internal reset is released, the 13-stage counter is reset and the mcu exits reset normally using extali clock. however, if the crystal start-up time is longer than the initial count of 4096 xclk cycles, or in the absence of an external clock, the mcu will leave the reset state in limp-home mode. the lhome flag is set and lhif limp-home interrupt request is set, to indicate it is not operating at the desired frequency. then after yet another 4096 xclk cycles followed regularly by 8192 xclk cycles (corresponding to the 13-stage counter timing out), a check of the clock monitor status is performed. when the presence of an external clock is detected limp-home mode is exited generating a limp-home interrupt if enabled. caution: the clock monitor circuit can be misled by the extali clock into reporting a good signal before it has fully stabilised. under these conditions improper extali clock cycles can occur on sysclk. this may lead to a code runaway. to ensure that this situation does not occur, the external reset period should be longer than the oscillator stabilisation time - this is an application dependent parameter. with the vddpll supply voltage at vss level, the pll module and hence limp-home mode are disabled, the device will remain effectively in a static state whilst there is no activity on extali. the internal reset period and mcu operation will execute only on extali clock. note: the external clock signal must stabilise within the initial 4096 reset counter cycles.
clock functions mc68hc912dt128a rev 2.0 146 clock functions motorola stop exit and fast stop recovery stop mode is entered when a stop instruction is executed. recovery from stop depends primarily on the state of the three status bits nolhm, cme & dly. the dly bit controls the duration of the waiting period between the actual exit for some key blocks (e.g. clock monitor, clock generators) and the effective exit from stop for all the rest of the mcu. dly=1 enables the 13-stage counter to generate a 4096 count delay. dly=0 selects no delay. as the xclk is derived from the slow mode divider, the value in the slow register modifies the actual delay time. note: dly=0 is only recommended when there is a good signal available at the extal pin (e.g. an external square wave source). stop mode is exited with an external reset, an external interrupt from irq or xirq, a key wake-up interrupt from port j or port h, or an mscan wake-up interrupt. figure 17 stop exit and fast stop recovery clock monitor fail extali 13-stage counter 0 --> 4096 limp-home (clocked by xclk) bcsp restore bcsp sysclk pllclk (l.h.) restore pllclk or extali stop (dly = 1) stop (dly = 0) 12-clock
clock functions limp-home and fast stop recovery modes mc68hc912dt128a rev 2.0 motorola clock functions 147 13-clock stop exit without limp home mode, clock monitor disabled (nolhm=1, cme=0, dly=x) if limp home mode is disabled (v ddpll =v ss or nolhm bit set) and the cme (or fcme) bit is cleared, the mcu goes into stop mode when a stop instruction is executed. if extali clock is present then exit from stop will occur normally using this clock. under this condition, dly should always be set to allow the crystal to stabilise and minimise the risk of code runaway. with dly=1 execution resumes after a delay of 4096 xclk cycles. note: the external clock signal should stabilise within the 4096 reset counter cycles. use of dly=0 is not recommended due to this requirement. executing the stop instruction without limp home mode, clock monitor enabled (nolhm=1, cme=1, dly=x) if the nolhm bit and the cme (or fcme) bits are set, a clock monitor failure is detected when a stop instruction is executed and the mcu resets via the clock monitor reset vector. stop exit in limp home mode with delay (nolhm=0, cme=x, dly=1) if the nolhm bit is cleared, then the cme (or fcme) bit is masked when a stop instruction is executed to prevent a clock monitor failure. when coming out of stop mode, the mcu goes into limp-home mode where cme and fcme signals are asserted. when using a crystal oscillator, a normal stop exit sequence requires the dly bit to be set to allow for the crystal stabilization period. with the 13-stage counter clocked by the vco (at f vcomin ), following a delay of 4096 xclk cycles at the limp-home frequency, if the clock monitor indicates the presence of an external clock, the limp-home mode is de-asserted and the mcu exits stop normally using extali clock. where the crystal start-up time is longer than the initial count of 4096 xclk cycles, or in the absence of an external clock, the mcu recovers from stop following the 4096 count in limp-home mode with both the lhome flag set and the lhif limp-home interrupt request set to indicate
clock functions mc68hc912dt128a rev 2.0 148 clock functions motorola it is not operating at the desired frequency. each time the 13-stage counter reaches a count of 4096 xclk cycles, a check of the clock monitor status is performed. when the presence of an external clock is detected, limp-home mode is exited and the lhome flag is cleared. this sets the limp-home interrupt flag and if enabled by the lhie bit, the limp-home mode interrupt is requested. caution: the clock monitor circuit can be misled by extali clock into reporting a good signal before it has fully stabilised. under these conditions, improper extali clock cycles can occur on sysclk. this may lead to a code runaway. stop exit in limp home mode without delay ( fast stop recovery) (nolhm=0, cme=x, dly=0) fast stop recovery refers to any exit from stop using dly=0. if the nolhm bit is cleared, then the cme (or fcme) bit is masked when a stop instruction is executed to prevent a clock monitor failure. when coming out of stop mode, the mcu goes into limp-home mode where cme and fcme signals are asserted. when using a crystal oscillator, it is possible to exit stop with the dly bit cleared. in this case, stop is de-asserted without delay and the mcu will execute software in limp-home mode, giving the crystal oscillator time to stablise. caution: this mode is not recommended since the risk of the clock monitor detecting incorrect clocks is high. 14-clock
clock functions limp-home and fast stop recovery modes mc68hc912dt128a rev 2.0 motorola clock functions 149 15-clock each time the 13-stage counter reaches a count of 4096 xclk cycles (every 8192 cycles), a check of the clock monitor status is performed. if the clock monitor indicates the presence of an external clock limp-home mode is de-asserted, the lhome flag is cleared and the limp-home interrupt flag is set. upon leaving limp-home mode, bcsp and mcs are restored to their values before the loss of clock, and all clocks return to their previous frequencies. if auto and bcsp were set before the clock loss, the sysclk ramps-up and the pll locks at the previously selected frequency. to prevent pll operation when the external clock frequency comes back, the software should clear the bcsp bit while running in limp-home mode. when using an external clock, i.e. a square wave source, it is possible to exit stop with the dly bit cleared. in this case the lhome flag is never set and stop is de-asserted without delay. pseudo-stop pseudo-stop is a low power mode similar to stop where the external oscillator is allowed to run (at reduced amplitude) whilst the rest of the part is in stop. this increases the current consumption over stop mode by the amount of current in the oscillator, but reduces wear and mechanical stress on the crystal. if the pstp bit in the pllcr register is set, the mcu goes into pseudo-stop mode when a stop instruction is executed. pseudo-stop mode is exited the same as stop with an external reset, an external interrupt from irq or xirq, a key wake-up interrupt from port j or port h, or an mscan wake-up interrupt. the effect of the dly bit is the same as noted above in stop exit and fast stop recovery .
clock functions mc68hc912dt128a rev 2.0 150 clock functions motorola pseudo-stop exit in limp home mode with delay (nolhm=0, cme=x, dly=1) when coming out of pseudo-stop mode with the nolhm bit cleared and the dly bit set, the mcu goes into limp-home mode (regardless of the state of the cme or fcme bits). the vco supplies the limp-home clock frequency to the 13-stage counter (xclk). the bcsp output is forced high and mcs is forced low. after the 13-stage counter reaches a count of 4096 xclk cycles, a check of the clock monitor is performed and as the crystal oscillator was kept running due to the pseudo-stop mode, the mcu exits stop normally, using the extali clock. in the case where a crystal failure occurred during pseudo-stop, then the mcu exits stop using the limp home clock (f vcomin ) with both the lhome flag set and the lhif limp-home interrupt request set to indicate it is not operating at the desired frequency. each time the 13-stage counter reaches a count of 4096 xclk cycles, a check of the clock monitor is performed. if the clock monitor indicates the presence of an external clock, limp-home mode is de-asserted, the lhome flag is cleared and the lhif limp-home interrupt request is set to indicate a return to normal operation using extali clock. pseudo-stop exit in limp home mode without delay ( fast stop recovery) (nolhm=0, cme=x, dly=0) if pseudo-stop is exited with the nolhm bit set to 0 and the dly bit is cleared then the exit from pseudo-stop is accomplished without delay as in fast stop recovery. caution: where pseudo-stop recovers using the limp home clock the vco - which has been held in stop - must be restarted in order to supply the limp home frequency. this restart, which occurs at a high frequency and ramps toward the limp home frequency, is almost immediately supplied to the cpu before it may have reached the steady state frequency. it is possible that the initial clock frequency may be high enough to cause the cpu to function incorrectly with a resultant risk of code runaway. 16-clock
clock functions limp-home and fast stop recovery modes mc68hc912dt128a rev 2.0 motorola clock functions 151 17-clock pseudo-stop exit without limp home mode, clock monitor enabled (nolhm=1, cme=1, dly=x) if the nolhm bit is set and the cme (or fcme) bits are set, a clock monitor failure is detected when a stop instruction is executed and the mcu resets via the clock monitor reset vector. pseudo-stop exit without limp home mode, clock monitor disabled (nolhm=1, cme=0, dly=1) if nolhm is set to 1 and the cme and fcme bits are cleared, the limp home clock is not used. in this mode, crystal activity is the only method by which the device may recover from pseudo-stop. the device will start execution with the extali clock following 4096 xclk cycles. (nolhm=1, cme=0, dly=0) if nolhm is set to 1 and the cme and fcme bits are cleared, the limp home clock is not used. in this mode, crystal activity is the only method by which the device may recover from pseudo-stop. the device will start execution with the extali clock following 16 xclk cycles. caution: due to switching of the clock this configuration is not recommended. summary of stop and pseudo-stop mode exit conditions table 23 and table 24 summarise the exit conditions from stop and pseudo-stop modes using interrupt, key-interrupt and xirq. a short reset pulse should not be used to exit stop or pseudo-stop mode because limp home mode is automatically entered after reset (when v ddpll =v dd ). the reset wakeup pulse must be longer than the oscillator startup time (as in power on reset) in order to remove the risk of code runaway.
clock functions mc68hc912dt128a rev 2.0 152 clock functions motorola .. table 23 summary of stop mode exit conditions mode conditions summary stop exit without limp home mode, clock monitor disabled nolhm=1 cme=0 dly=x oscillator must be stable within 4096 xclk cycles. xclk can be modified by slow divider register. use of dly=0 only recommended with external clock. executing the stop instruction without limp home mode, clock monitor enabled nolhm=1 cme=1 dly=x when a stop instruction is executed the mcu resets via the clock monitor reset vector. stop exit in limp home mode with delay nolhm=0 cme=x dly=1 oscillator must be stable within 4096 f vcomin cycles or there is a possibility of code runaway as the clock monitor circuit can be misled by extali clock into reporting a good signal before it has fully stabilised stop exit in limp home mode without delay (fast stop recovery) nolhm=0 cme=x dly=0 this mode is only recommended for use with an external clock source. table 24 summary of pseudo stop mode exit conditions mode conditions summary pseudo-stop exit in limp home mode with delay nolhm=0 cme=x dly=1 cpu exits stop in limp home mode and oscillator running. if the oscillator fails during pseudo-stop and then recovers there is a possibility of code runaway as the clock monitor circuit can be misled by extali clock into reporting a good signal before it has fully stabilised pseudo-stop exit in limp home mode without delay (fast stop recovery) nolhm=0 cme=x dly=0 this mode is not recommended as it is possible that the initial vco clock frequency may be high enough to cause code runaway. pseudo-stop exit without limp home mode, clock monitor enabled nolhm=1 cme=1 dly=x when a stop instruction is executed the mcu resets via the clock monitor reset vector. pseudo-stop exit without limp home mode, clock monitor disabled, with delay nolhm=1 cme=0 dly=1 oscillator starts operation following 4096 xclk cycles (actual controlled by slow mode divider). pseudo-stop exit without limp home mode, clock monitor disabled, without delay nolhm=1 cme=0 dly=0 this mode is only recommended for use with an external clock source. 18-clock
clock functions limp-home and fast stop recovery modes mc68hc912dt128a rev 2.0 motorola clock functions 153 19-clock pll register descriptions read anytime, write anytime, except when bcsp = 1 (pll selected as bus clock). if the pll is on, the count in the loop divider (synr) register effectively multiplies up the bus frequency from the pll reference frequency by synr + 1. internally, sysclk runs at twice the bus frequency. caution should be used not to exceed the maximum rated operating frequency for the cpu. read anytime, write anytime, except when bcsp = 1. the reference divider bits provides a finer granularity for the pll multiplier steps. the reference frequency is divided by refdv + 1. always reads zero, except in test modes. synr ? synthesizer register $0038 bit 7654321bit 0 0 0 syn5 syn4 syn3 syn2 syn1 syn0 reset: 0 0 0 0 0 0 0 0 refdv ? reference divider register $0039 bit 7654321bit 0 0 0 0 0 0 refdv2 refdv1 refdv0 reset: 0 0 000000 cgtflg ? clock generator test register $003a bit 7654321bit 0 tstout7 tstout6 tstout5 tstout4 tstout3 tstout2 tstout1 tstout0 reset: 0 0 000000
clock functions mc68hc912dt128a rev 2.0 154 clock functions motorola read anytime, refer to each bit for write conditions. lockif ? pll lock interrupt flag 0 = no change in lock bit. 1 = lock condition has changed, either from a locked state to an unlocked state or vice versa. to clear the flag, write one to this bit in pllflg. cleared in limp-home mode. lock ? locked phase lock loop circuit regardless of the bandwidth control mode (automatic or manual): 0 = pll vco is not within the desired tolerance of the target frequency. 1 = after the phase lock loop circuit is turned on, indicates the pll vco is within the desired tolerance of the target frequency. write has no effect on lock bit. this bit is cleared in limp-home mode as the lock detector cannot operate without the reference frequency. lhif ? limp-home interrupt flag 0 = no change in lhome bit. 1 = lhome condition has changed, either entered or exited limp-home mode. to clear the flag, write one to this bit in pllflg. lhome ? limp-home mode status 0 = mcu is operating normally, with extali clock available for generating clocks or as pll reference. 1 = loss of reference clock. cgm delivers pll vco limp-home frequency to the mcu. for limp-home mode, see limp-home and fast stop recovery modes . pllflg ? pll flags $003b bit 7654321bit 0 lockif lock 0 0 0 0 lhif lhome reset: 0 0 0 0 0 0 0 0 20-clock
clock functions limp-home and fast stop recovery modes mc68hc912dt128a rev 2.0 motorola clock functions 155 21-clock read and write anytime. exceptions are listed below for each bit. lockie ? pll lock interrupt enable 0 = pll lock interrupt is disabled 1 = pll lock interrupt is enabled forced to 0 when vddpll=0. pllon ? phase lock loop on 0 = turns the pll off. 1 = turns on the phase lock loop circuit. if auto is set, the pll will lock automatically. cannot be cleared when bcsp = 1 (pll selected as bus clock). forced to 0 when vddpll is at vss level. in limp-home mode, the output of pllon is forced to 1, but the pllon bit reads the latched value. auto ? automatic bandwidth control 0 = automatic mode control is disabled and the pll is under software control, using acq bit. 1 = automatic mode control is enabled. acq bit is read only. automatic bandwidth control selects either the high bandwidth (acquisition) mode or the low bandwidth (tracking) mode depending on how close to the desired frequency the vco is running. see electrical characteristics . pllcr ? pll control register $003c bit 7654321bit 0 lockie pllon auto acq 0 pstp lhie nolhm reset: 0 ? (1) 10000 ? (2) 1. set when vddpll power supply is high. forced to 0 when vddpll is low. 2. cleared when vddpll power supply is high. forced to 1 when vddpll is low.
clock functions mc68hc912dt128a rev 2.0 156 clock functions motorola acq ? not in acquisition if auto = 1 (acq is read only) 0 = pll vco is not within the desired tolerance of the target frequency. the loop filter is in high bandwidth, acquisition mode. 1 = after the phase lock loop circuit is turned on, indicates the pll vco is within the desired tolerance of the target frequency. the loop filter is in low bandwidth, tracking mode. if auto = 0 0 = high bandwidth pll loop selected 1 = low bandwidth pll loop selected pstp ? pseudo-stop enable 0 = pseudo-stop oscillator mode is disabled 1 = pseudo-stop oscillator mode is enabled in pseudo-stop mode, the oscillator is still running while the mcu is maintained in stop mode. this allows for a faster stop recovery and reduces the mechanical stress and aging of the resonator in case frequent stop conditions at the expense of a slightly increased power consumption. lhie ? limp-home interrupt enable 0 = limp-home interrupt is disabled 1 = limp-home interrupt is enabled forced to 0 when vddpll is at vss level. nolhm ? no limp-home mode 0 = loss of reference clock forces the mcu in limp-home mode. 1 = loss of reference clock causes standard clock monitor reset. read anytime; normal modes: write once; special modes: write anytime. forced to 1 when vddpll is at vss level. 22-clock
clock functions limp-home and fast stop recovery modes mc68hc912dt128a rev 2.0 motorola clock functions 157 23-clock read and write anytime. exceptions are listed below for each bit. bcsp and bcss bits determine the clock used by the main system including the cpu and buses. bcsp ? bus clock select pll 0 = sysclk is derived from the crystal clock or from slwclk. 1 = sysclk source is the pll. cannot be set when pllon = 0. in limp-home mode, the output of bcsp is forced to 1, but the bcsp bit reads the latched value. bcss ? bus clock select slow 0 = sysclk is derived from the crystal clock extali. 1 = sysclk source is the slow clock slwclk. this bit has no effect when bcsp is set. mcs ? module clock select 0 = m clock is the same as pclk. 1 = m clock is derived from slow clock slwclk. this bit determines the clock used by the ect module and the baud rate generators of the scis. in limp-home mode, the output of mcs is forced to 0, but the mcs bit reads the latched value. clksel ? clock generator clock select register $003d bit 7654321bit 0 0 bcsp bcss 0 0 mcs 0 0 reset: 0 0 0 0 0 0 0 0
clock functions mc68hc912dt128a rev 2.0 158 clock functions motorola read and write anytime. a write to this register changes the slwclk frequency with minimum delay (less than one slwclk cycle), thus allowing immediate tune-up of the performance versus power consumption for the modules using this clock. the frequency divide ratio is 2 times (slow), hence the divide range is 2 to 126 (not on first pass products). when slow = 0, the divider is bypassed. the generation of e, p and m clocks further divides slwclk by 2. hence, the final ratio of bus to extali frequency is programmable to 2, 4, 8, 12, 16, 20, ..., 252, by steps of 4. slwclk is a 50% duty cycle signal. slow ? slow mode divider register $003e bit 7654321bit 0 0 0 sldv5 sldv4 sldv3 sldv2 sldv1 sldv0 reset: 0 0 0 0 0 0 0 0 24-clock
clock functions system clock frequency formulae mc68hc912dt128a rev 2.0 motorola clock functions 159 25-clock system clock frequency formulae see figure 18 : slwclk = extali / ( 2 x slow ) slow = 1,2,..63 slwclk = extali slow = 0 pllclk = 2 x extali x (synr + 1) / (refdv + 1) eclk = sysclk / 2 xclk = slwclk / 2 pclk = sysclk / 2 bclk 1 = extali / 2 boolean equations: sysclk = (bcsp & pllclk) | (bcsp & bcss & extali) | (bcsp & bcss & slwclk) mclk = (pclk & mcs ) | (xclk & mcs) mscan system = (extali & clksrc) | (sysclk & clksrc) bdm system = (bclk & clksw) | (eclk & clksw) note: during limp-home mode pclk, eclk, bclk, mclk and xclk are supplied by vco (pllclk). 1. if sysclk is slower than extali (bcss=1, bcsp=0, slow>0), bclk becomes eclk.
clock functions mc68hc912dt128a rev 2.0 160 clock functions motorola clock divider chains figure 18 , figure 19 , figure 20 , and figure 21 summarize the clock divider chains for the various peripherals on the 68hc912d60a. figure 18 clock generation chain reduced consumption oscillator phase lock loop extal xtal 0:0 sysclk to buses, spi, pwm, atd0, atd1 to rti, cop bcsp bcss slow mode clock divider extali extali extali slwclk pllclk 0:1 bcsp bcss 1:x bcsp bcss mcs = 0 mcs = 1 2 2 to mscan clksrc = 0 tclks t clock generator e and p clock generator pclk eclk xclk to sci0, sci1, ect to cpu sync mclk to bdm 2 sync to cal to clock monitor clksrc = 1 clksw = 0 clksw = 1 26-clock
clock functions clock divider chains mc68hc912dt128a rev 2.0 motorola clock functions 161 27-clock bus clock select bits bcsp and bcss in the clock select register (clksel) determine which clock drives sysclk for the main system including the cpu and buses. bcss has no effect if bcsp is set. during the transition, the clock select output will be held low and all cpu activity will cease until the transition is complete. the module clock select bit mcs determines the clock used by the ect module and the baud rate generators of the scis. in limp-home mode, the output of mcs is forced to 0, but the mcs bit reads the latched value. it allows normal operation of the serial and timer subsystems at a fixed reference frequency while allowing the cpu to operate at a higher, variable frequency. figure 19 clock chain for sci0, sci1, rti, cop xclk sc0bd modulus divider: 1, 2, 3, 4, 5, 6,...,8190, 8191 sci0 receive baud rate (16x) sci0 transmit baud rate (1x) bits: rtr2, rtr1, rtr0 to rti bits: cr2, cr1, cr0 to cop 16 sci1 receive baud rate (16x) sci1 transmit baud rate (1x) 16 0:0:0 0:0:1 0:1:0 0:1:1 1:0:0 1:0:1 1:1:0 1:1:1 2 2 2 2 2 2 0:0:0 0:0:1 0:1:0 0:1:1 1:0:0 1:0:1 1:1:0 1:1:1 4 4 4 2 4 2 4 register: copctl register: rtictl sc1bd modulus divider: 1, 2, 3, 4, 5, 6,...,8190, 8191 register: rtictl bit:rtbyp 2048 mclk
clock functions mc68hc912dt128a rev 2.0 162 clock functions motorola figure 20 clock chain for ect bits: pr2, pr1, pr0 mclk pamod paclk pulse acc low byte paclk/256 pulse acc high byte paclk/65536 (paov) gate logic bits: paen, clk1, clk0 ten register: pactl register: tmsk2 paen 0:0:0 0:0:1 2 0:1:0 2 0:1:1 2 1:0:0 2 1:0:1 2 1:1:0 2 1:1:1 2 bits: mcpr1, mcpr0 mcen register: mcctl 0:0 0:1 4 1:0 2 1:1 2 0:x:x 1:0:0 1:0:1 1:1:0 1:1:1 to timer main counter (tcnt) modulus down counter port t7 prescaled mclk 28-clock
clock functions computer operating properly (cop) mc68hc912dt128a rev 2.0 motorola clock functions 163 29-clock figure 21 clock chain for mscan, spi, atd0, atd1 and bdm computer operating properly (cop) the cop or watchdog timer is an added check that a program is running and sequencing properly. when the cop is being used, software is responsible for keeping a free running watchdog timer from timing out. if the watchdog timer times out it is an indication that the software is no longer being executed in the intended sequence; thus a system reset is initiated. three control bits allow selection of seven cop time-out periods. when cop is enabled, sometime during the selected period the program must write $55 and $aa (in this order) to the coprst register. if the program fails to do this the part will reset. if any value other than $55 or $aa is written, the part is reset. pclk bits : spr2, spr1, spr0 spi bit rate 5-bit modulus counter (pr0-pr4) to atd0 and atd1 bkgd bdm bit clock: receive: detect falling edge, count 12 e clocks, sample input transmit 1: detect falling edge, count 6 e clocks while output is high impedance, drive out 1 e cycle pulse high, high imped- ance output again transmit 0: detect falling edge, drive out low, count 9 e clocks, drive out 1 e cycle pulse high, high impedance output pin synchronizer logic bkgd in bkgd out bkgd direction 2 0:0:0 0:0:1 0:1:0 0:1:1 1:0:0 1:0:1 1:1:0 1:1:1 2 2 2 2 2 2 2 2 register: sp0br mscan clock clksrc extali sysclk clksw eclk bclk
clock functions mc68hc912dt128a rev 2.0 164 clock functions motorola in addition, windowed cop operation can be selected. in this mode, writes to the coprst register must occur in the last 25% of the selected period. a premature write will also reset the part. real-time interrupt there is a real time (periodic) interrupt available to the user. this interrupt will occur at one of seven selected rates. an interrupt flag and an interrupt enable bit are associated with this function. there are three bits for the rate select. clock monitor the clock monitor circuit is based on an internal resistor-capacitor (rc) time delay. if no extali clock edges are detected within this rc time delay, the clock monitor can optionally generate a system reset. the clock monitor function is enabled/disabled by the cme control bit in the copctl register. this time-out is based on an rc delay so that the clock monitor can operate without any extali clock. clock monitor time-outs are shown in table 25 . the corresponding extali clock period with an ideal 50% duty cycle is twice this time-out value. table 25 clock monitor time-outs supply range 5 v +/ ? 10% 2 ? 20 s 30-clock
clock functions clock function registers mc68hc912dt128a rev 2.0 motorola clock functions 165 31-clock clock function registers all register addresses shown reflect the reset state. registers may be mapped to any 2k byte space. rtie ? real time interrupt enable read and write anytime. 0 = interrupt requests from rti are disabled. 1 = interrupt will be requested whenever rtif is set. rswai ? rti and cop stop while in wait write once in normal modes, anytime in special modes. read anytime. 0 = allows the rti and cop to continue running in wait. 1 = disables both the rti and cop whenever the part goes into wait. rsbck ? rti and cop stop while in background debug mode write once in normal modes, anytime in special modes. read anytime. 0 = allows the rti and cop to continue running while in background mode. 1 = disables both the rti and cop when the part is in background mode. this is useful for emulation. rtbyp ? real time interrupt divider chain bypass write not allowed in normal modes, anytime in special modes. read anytime. 0 = divider chain functions normally. 1 = divider chain is bypassed, allows faster testing (the divider chain is normally xclk divided by 2 13 , when bypassed becomes xclk divided by 4). rtictl ? real-time interrupt control register $0014 bit 7654321bit 0 rtie rswai rsbck reserved rtbyp rtr2 rtr1 rtr0 reset:00000000
clock functions mc68hc912dt128a rev 2.0 166 clock functions motorola rtr2, rtr1, rtr0 ? real-time interrupt rate select read and write anytime. rate select for real-time interrupt. the clock used for this module is the xclk. rtif ? real time interrupt flag this bit is cleared automatically by a write to this register with this bit set. 0 = time-out has not yet occurred. 1 = set when the time-out period is met. table 26 real time interrupt rates rtr2 rtr1 rtr0 divide x by: time-out period x = 125 khz time-out period x = 500 khz time-out period x = 2.0 mhz time-out period x = 8.0 mhz 0 0 0 off off off off off 001 2 13 65.536 ms 16.384 ms 4.096 ms 1.024 ms 010 2 14 131.72 ms 32.768 ms 8.196 ms 2.048 ms 011 2 15 263.44 ms 65.536 ms 16.384 ms 4.096 ms 100 2 16 526.88 ms 131.72 ms 32.768 ms 8.196 ms 101 2 17 1.05 s 263.44 ms 65.536 ms 16.384 ms 110 2 18 2.11 s 526.88 ms 131.72 ms 32.768 ms 111 2 19 4.22 s 1.05 s 263.44 ms 65.536 ms rtiflg ? real time interrupt flag register $0015 bit 7654321bit 0 rtif0000000 reset: 0 0 0 0 0 0 0 0 32-clock
clock functions clock function registers mc68hc912dt128a rev 2.0 motorola clock functions 167 33-clock cme ? clock monitor enable read and write anytime. if fcme is set, this bit has no meaning nor effect. 0 = clock monitor is disabled. slow clocks and stop instruction may be used. 1 = slow or stopped clocks (including the stop instruction) will cause a clock reset sequence or limp-home mode. see limp-home and fast stop recovery modes . on reset cme is 1 if vddpll is high cme is 0 if vddpll is low. note: the vddpll-dependent reset operation is not implemented on first pass products. in this case the state of cme on reset is 0. fcme ? force clock monitor enable write once in normal modes, anytime in special modes. read anytime. in normal modes, when this bit is set, the clock monitor function cannot be disabled until a reset occurs. 0 = clock monitor follows the state of the cme bit. 1 = slow or stopped clocks will cause a clock reset sequence or limp-home mode. see limp-home and fast stop recovery modes . copctl ? cop control register $0016 bit 7654321bit 0 cme fcme fcmcop wcop disr cr2 cr1 cr0 reset: 0/1 0 000111normal reset: 0/1 0 001111special
clock functions mc68hc912dt128a rev 2.0 168 clock functions motorola fcmcop ? force clock monitor reset or cop watchdog reset writes are not allowed in normal modes, anytime in special modes. read anytime. if disr is set, this bit has no effect. 0 = normal operation. 1 = a clock monitor failure reset or a cop failure reset is forced depending on the state of cme and if cop is enabled. wcop ? window cop mode write once in normal modes, anytime in special modes. read anytime. 0 = normal cop operation 1 = window cop operation when set, a write to the coprst register must occur in the last 25% of the selected period. a premature write will also reset the part. as long as all writes occur during this window, $55 can be written as often as desired. once $aa is written the time-out logic restarts and the user must wait until the next window before writing to coprst. please note, there is a fixed time uncertainty about the exact cop counter state when reset, as the initial prescale clock divider in the rti section is not cleared when the cop counter is cleared. this means the effective window is reduced by this uncertainty. table 27 below shows the exact duration of this window for the seven available cop rates. cme cop enabled forced reset 0 0 none 0 1 cop failure 1 0 clock monitor failure 11 both (1) 1. highest priority interrupt vector is serviced. 34-clock
clock functions clock function registers mc68hc912dt128a rev 2.0 motorola clock functions 169 35-clock disr ? disable resets from cop watchdog and clock monitor writes are not allowed in normal modes, anytime in special modes. read anytime. 0 = normal operation. 1 = regardless of other control bit states, cop and clock monitor will not generate a system reset. cr2, cr1, cr0 ? cop watchdog timer rate select bits these bits select the cop time-out rate. the clock used for this module is the xclk. write once in normal modes, anytime in special modes. read anytime. table 27 cop watchdog rates cr2 cr1 cr0 divide xclk by 8.0 mhz xclk time-out window cop enabled: window start (1) window end effective window (2) 0 0 0 off off off off off 001 2 13 1.024 ms -0/+0.256 ms 0.768 ms 0.768 ms 0 % (3) 010 2 15 4.096 ms -0/+0.256 ms 3.072 ms 3.840 ms 18.8 % 011 2 17 16.384 ms -0/+0.256 ms 12.288 ms 16.128 ms 23.4 % 100 2 19 65.536 ms -0/+1.024 ms 49.152 ms 64.512 ms 23.4 % 101 2 21 262.144 ms -0/+1.024 ms 196.608 ms 261.120 ms 24.6 % 110 2 22 524.288 ms -0/+1.024 ms 393.216 ms 523.264 ms 24.8 % 111 2 23 1.048576 ms -0/+1.024 ms 786.432 ms 1.047552 ms 24.9 % 1. time for writing $55 following previous cop restart of time-out logic due to writing $aa. 2. please refer to wcop bit description above. 3. window cop cannot be used at this rate.
clock functions mc68hc912dt128a rev 2.0 170 clock functions motorola always reads $00. writing $55 to this address is the first step of the cop watchdog sequence. writing $aa to this address is the second step of the cop watchdog sequence. other instructions may be executed between these writes but both must be completed in the correct order prior to time-out to avoid a watchdog reset. writing anything other than $55 or $aa causes a cop reset to occur. coprst ? arm/reset cop timer register $0017 bit 7654321bit 0 bit 7654321bit 0 reset: 00000000 36-clock
mc68hc912dt128a rev 2.0 motorola pulse-width modulator 171 pulse-width modulator pulse-width modulator contents introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171 pwm register descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 pwm boundary cases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186 introduction the pulse-width modulator (pwm) subsystem provides four independent 8-bit pwm waveforms or two 16-bit pwm waveforms or a combination of one 16-bit and two 8-bit pwm waveforms. each waveform channel has a programmable period and a programmable duty-cycle as well as a dedicated counter. a flexible clock select scheme allows four different clock sources to be used with the counters. each of the modulators can create independent, continuous waveforms with software-selectable duty rates from 0 percent to 100 percent. the pwm outputs can be programmed as left-aligned outputs or center-aligned outputs. the period and duty registers are double buffered so that if they change while the channel is enabled, the change will not take effect until the counter rolls over or the channel is disabled. if the channel is not enabled, then writes to the period and/or duty register will go directly to the latches as well as the buffer, thus ensuring that the pwm output will always be either the old waveform or the new waveform, not some variation in between. a change in duty or period can be forced into immediate effect by writing the new value to the duty and/or period registers and then writing to the counter. this causes the counter to reset and the new duty and/or period values to be latched. in addition, since the counter is readable it is 1-pwm
pulse-width modulator mc68hc912dt128a rev 2.0 172 pulse-width modulator motorola possible to know where the count is with respect to the duty value and software can be used to make adjustments by turning the enable bit off and on. the four pwm channel outputs share general-purpose port p pins. enabling pwm pins takes precedence over the general-purpose port. when pwm are not in use, the port pins may be used for discrete input/ output. figure 22 block diagram of pwm left-aligned output channel gate pwcntx 8-bit compare = pwdtyx 8-bit compare = pwperx up /down from port p data register to pin driver ppolx clock source (eclk or scaled eclk) (clock edge sync) reset centr = 0 mux mux s r q q pwper pwdty pwenx ppol = 0 ppol = 1 sync 2--pwm
pulse-width modulator introduction mc68hc912dt128a rev 2.0 motorola pulse-width modulator 173 figure 23 block diagram of pwm center-aligned output channel gate pwcntx 8-bit compare = pwdtyx 8-bit compare = pwperx reset from port p data register to pin driver ppolx clock source (eclk or scaled eclk) (clock edge sync) up /down centr = 1 mux mux t q q pwdty pwenx ppol = 1 ppol = 0 (duty cycle) (period) pwper 2 (pwper ? pwdty) 2 pwdty sync 3-pwm
pulse-width modulator mc68hc912dt128a rev 2.0 174 pulse-width modulator motorola figure 24 pwm clock sources 8-bit down counter pclk2 mux pclk3 mux clock to pwm channel 2 clock to pwm channel 3 2 pwscnt1 8-bit scale register pwscal1 clock b clock s1** **clock s1 = (clock b)/2, (clock b)/4, (clock b)/6,... (clock b)/512 2 0:0:0 0:0:1 0:1:0 0:1:1 1:0:0 1:0:1 1:1:0 1:1:1 2 2 2 2 2 2 0:0:0 0:0:1 0:1:0 0:1:1 1:0:0 1:0:1 1:1:0 1:1:1 8-bit down counter pclk0 mux pclk1 mux clock to pwm channel 0 clock to pwm channel 1 2 pwscnt0 8-bit scale register pwscal0 clock a clock s0* *clock s0 = (clock a)/2, (clock a)/4, (clock a)/6,... (clock a)/512 register: bits: pckb2, pckb0 pckb1, = 0 = 0 bits: pcka2, pcka0 pcka1, pwpres psbck limbdm eclk psbck is bit 0 of pwctl register. internal signal limbdm is one if the mcu is in background debug mode. 4-pwm
pulse-width modulator pwm register descriptions mc68hc912dt128a rev 2.0 motorola pulse-width modulator 175 pwm register descriptions read and write anytime. con23 ? concatenate pwm channels 2 and 3 when concatenated, channel 2 becomes the high-order byte and channel 3 becomes the low-order byte. channel 2 output pin is used as the output for this 16-bit pwm (bit 2 of port p). channel 3 clock-select control bits determines the clock source. channel 3 output pin becomes a general purpose i/o. 0 = channels 2 and 3 are separate 8-bit pwms. 1 = channels 2 and 3 are concatenated to create one 16-bit pwm channel. con01 ? concatenate pwm channels 0 and 1 when concatenated, channel 0 becomes the high-order byte and channel 1 becomes the low-order byte. channel 0 output pin is used as the output for this 16-bit pwm (bit 0 of port p). channel 1 clock-select control bits determine the clock source. channel 1 output pin becomes a general purpose i/o. 0 = channels 0 and 1 are separate 8-bit pwms. 1 = channels 0 and 1 are concatenated to create one 16-bit pwm channel. pcka2 ? pcka0 ? prescaler for clock a clock a is one of two clock sources which may be used for channels 0 and 1. these three bits determine the rate of clock a, as shown in table 28 . pckb2 ? pckb0 ? prescaler for clock b clock b is one of two clock sources which may be used for channels 2 and 3. these three bits determine the rate of clock b, as shown in table 28 . pwclk ? pwm clocks and concatenate $0040 bit 7 6 5 4 3 2 1 bit 0 con23 con01 pcka2 pcka1 pcka0 pckb2 pckb1 pckb0 reset: 0 0 0 0 0 0 0 0 5-pwm
pulse-width modulator mc68hc912dt128a rev 2.0 176 pulse-width modulator motorola read and write anytime. pclk3 ? pwm channel 3 clock select 0 = clock b is the clock source for channel 3. 1 = clock s1 is the clock source for channel 3. pclk2 ? pwm channel 2 clock select 0 = clock b is the clock source for channel 2. 1 = clock s1 is the clock source for channel 2. pclk1 ? pwm channel 1 clock select 0 = clock a is the clock source for channel 1. 1 = clock s0 is the clock source for channel 1. pclk0 ? pwm channel 0 clock select 0 = clock a is the clock source for channel 0. 1 = clock s0 is the clock source for channel 0. if a clock select is changed while a pwm signal is being generated, a truncated or stretched pulse may occur during the transition. table 28 clock a and clock b prescaler pcka2 (pckb2) pcka1 (pckb1) pcka0 (pckb0) value of clock a (b) 000 p 001 p 2 010 p 4 011 p 8 100 p 16 101 p 32 110 p 64 111p 128 pwpol ? pwm clock select and polarity $0041 bit 7 6 5 4 3 2 1 bit 0 pclk3 pclk2 pclk1 pclk0 ppol3 ppol2 ppol1 ppol0 reset: 0 0 0 0 0 0 0 0 6-pwm
pulse-width modulator pwm register descriptions mc68hc912dt128a rev 2.0 motorola pulse-width modulator 177 7-pwm the following four bits apply in left-aligned mode only: ppol3 ? pwm channel 3 polarity 0 = channel 3 output is low at the beginning of the period; high when the duty count is reached. 1 = channel 3 output is high at the beginning of the period; low when the duty count is reached. ppol2 ? pwm channel 2 polarity 0 = channel 2 output is low at the beginning of the period; high when the duty count is reached. 1 = channel 2 output is high at the beginning of the period; low when the duty count is reached. ppol1 ? pwm channel 1 polarity 0 = channel 1 output is low at the beginning of the period; high when the duty count is reached. 1 = channel 1 output is high at the beginning of the period; low when the duty count is reached. ppol0 ? pwm channel 0 polarity 0 = channel 0 output is low at the beginning of the period; high when the duty count is reached. 1 = channel 0 output is high at the beginning of the period; low when the duty count is reached. depending on the polarity bit, the duty registers may contain the count of either the high time or the low time. if the polarity bit is zero and left alignment is selected, the duty registers contain a count of the low time. if the polarity bit is one, the duty registers contain a count of the high time.
pulse-width modulator mc68hc912dt128a rev 2.0 178 pulse-width modulator motorola setting any of the pwenx bits causes the associated port p line to become an output regardless of the state of the associated data direction register (ddrp) bit. this does not change the state of the data direction bit. when pwenx returns to zero, the data direction bit controls i/o direction. on the front end of the pwm channel, the scaler clock is enabled to the pwm circuit by the pwenx enable bit being high. when all four pwm channels are disabled, the prescaler counter shuts off to save power. there is an edge-synchronizing gate circuit to guarantee that the clock will only be enabled or disabled at an edge. read and write anytime. pwen3 ? pwm channel 3 enable the pulse modulated signal will be available at port p, bit 3 when its clock source begins its next cycle. 0 = channel 3 is disabled. 1 = channel 3 is enabled. pwen2 ? pwm channel 2 enable the pulse modulated signal will be available at port p, bit 2 when its clock source begins its next cycle. 0 = channel 2 is disabled. 1 = channel 2 is enabled. pwen1 ? pwm channel 1 enable the pulse modulated signal will be available at port p, bit 1 when its clock source begins its next cycle. 0 = channel 1 is disabled. 1 = channel 1 is enabled. pwen0 ? pwm channel 0 enable the pulse modulated signal will be available at port p, bit 0 when its clock source begins its next cycle. 0 = channel 0 is disabled. 1 = channel 0 is enabled. pwen ? pwm enable $0042 bit 7 6 5 4 3 2 1 bit 0 0 0 0 0 pwen3 pwen2 pwen1 pwen0 reset: 0 0 0 0 0 0 0 0 8-pwm
pulse-width modulator pwm register descriptions mc68hc912dt128a rev 2.0 motorola pulse-width modulator 179 9-pwm pwpres is a free-running 7-bit counter. read anytime. write only in special mode (smod = 1). read and write anytime. a write will cause the scaler counter pwscnt0 to load the pwscal0 value unless in special mode with discal = 1 in the pwtst register. pwm channels 0 and 1 can select clock s0 (scaled) as its input clock by setting the control bit pclk0 and pclk1 respectively. clock s0 is generated by dividing clock a by the value in the pwscal0 register + 1 and dividing again by two. when pwscal0 = $ff, clock a is divided by 256 then divided by two to generate clock s0. pwscnt0 is a down-counter that, upon reaching $00, loads the value of pwscal0. read any time. pwpres ? pwm prescale counter $0043 bit 7 6 5 4 3 2 1 bit 0 0 bit 6 5 4 3 2 1 bit 0 reset: 0 0 0 0 0 0 0 0 pwscal0 ? pwm scale register 0 $0044 bit 7 6 5 4 3 2 1 bit 0 bit 7 6 5 4 3 2 1 bit 0 reset: 0 0 0 0 0 0 0 0 pwscnt0 ? pwm scale counter 0 value $0045 bit 7 6 5 4 3 2 1 bit 0 bit 7 6 5 4 3 2 1 bit 0 reset: 0 0 0 0 0 0 0 0
pulse-width modulator mc68hc912dt128a rev 2.0 180 pulse-width modulator motorola read and write anytime. a write will cause the scaler counter pwscnt1 to load the pwscal1 value unless in special mode with discal = 1 in the pwtst register. pwm channels 2 and 3 can select clock s1 (scaled) as its input clock by setting the control bit pclk2 and pclk3 respectively. clock s1 is generated by dividing clock b by the value in the pwscal1 register + 1 and dividing again by two. when pwscal1 = $ff, clock b is divided by 256 then divided by two to generate clock s1. pwscnt1 is a down-counter that, upon reaching $00, loads the value of pwscal1. read any time. read and write anytime. a write will cause the pwm counter to reset to $00. in special mode, if discr = 1, a write does not reset the pwm counter. pwscal1 ? pwm scale register 1 $0046 bit 7 6 5 4 3 2 1 bit 0 bit 7 6 5 4 3 2 1 bit 0 reset: 0 0 0 0 0 0 0 0 pwscnt1 ? pwm scale counter 1 value $0047 bit 7 6 5 4 3 2 1 bit 0 bit 7 6 5 4 3 2 1 bit 0 reset: 0 0 0 0 0 0 0 0 pwcntx ? pwm channel counters bit 7 6 5 4 3 2 1 bit 0 pwcnt0 bit 7 6 5 4 3 2 1 bit 0 $0048 pwcnt1 bit 7 6 5 4 3 2 1 bit 0 $0049 pwcnt2 bit 7 6 5 4 3 2 1 bit 0 $004a pwcnt3 bit 7 6 5 4 3 2 1 bit 0 $004b reset: 0 0 0 0 0 0 0 0 10-pwm
pulse-width modulator pwm register descriptions mc68hc912dt128a rev 2.0 motorola pulse-width modulator 181 11-pwm the pwm counters are not reset when pwm channels are disabled. the counters must be reset prior to a new enable. each counter may be read any time without affecting the count or the operation of the corresponding pwm channel. writes to a counter cause the counter to be reset to $00 and force an immediate load of both duty and period registers with new values. to avoid a truncated pwm period, write to a counter while the counter is disabled. in left-aligned output mode, resetting the counter and starting the waveform output is controlled by a match between the period register and the value in the counter. in center-aligned output mode the counters operate as up/down counters, where a match in period changes the counter direction. the duty register changes the state of the output during the period to determine the duty. when a channel is enabled, the associated pwm counter starts at the count in the pwcntx register using the clock selected for that channel. in special mode, when discp = 1 and configured for left-aligned output, a match of period does not reset the associated pwm counter. read and write anytime. the value in the period register determines the period of the associated pwm channel. if written while the channel is enabled, the new value will not take effect until the existing period terminates, forcing the counter to reset. the new period is then latched and is used until a new period value is written. reading this register returns the most recent value written. to start a new period immediately, write the new period value pwperx ? pwm channel period registers bit 7 6 5 4 3 2 1 bit 0 pwper0 bit 7 6 5 4 3 2 1 bit 0 $004c pwper1 bit 7 6 5 4 3 2 1 bit 0 $004d pwper2 bit 7 6 5 4 3 2 1 bit 0 $004e pwper3 bit 7 6 5 4 3 2 1 bit 0 $004f reset: 1 1 1 1 1 1 1 1
pulse-width modulator mc68hc912dt128a rev 2.0 182 pulse-width modulator motorola and then write the counter forcing a new period to start with the new period value. period = channel-clock-period (pwper + 1) (centr = 0) period = channel-clock-period (2 pwper) (centr = 1) read and write anytime. the value in each duty register determines the duty of the associated pwm channel. when the duty value is equal to the counter value, the output changes state. if the register is written while the channel is enabled, the new value is held in a buffer until the counter rolls over or the channel is disabled. reading this register returns the most recent value written. if the duty register is greater than or equal to the value in the period register, there will be no duty change in state. if the duty register is set to $ff the output will always be in the state which would normally be the state opposite the ppolx value. left-aligned-output mode (centr = 0): duty cycle = [(pwdtyx+1) / (pwperx+1)] 100% (ppolx = 1) duty cycle = [(pwperx ? pwdtyx) / (pwperx+1)] 100% (ppolx = 0) center-aligned-output mode (centr = 1): duty cycle = [(pwperx ? pwdtyx) / pwperx] 100% (ppolx = 0) duty cycle = [pwdtyx / pwperx] 100% (ppolx = 1) pwdtyx ? pwm channel duty registers bit 7 6 5 4 3 2 1 bit 0 pwdty0 bit 7 6 5 4 3 2 1 bit 0 $0050 pwdty1 bit 7 6 5 4 3 2 1 bit 0 $0051 pwdty2 bit 7 6 5 4 3 2 1 bit 0 $0052 pwdty3 bit 7 6 5 4 3 2 1 bit 0 $0053 reset: 1 1 1 1 1 1 1 1 12-pwm
pulse-width modulator pwm register descriptions mc68hc912dt128a rev 2.0 motorola pulse-width modulator 183 13-pwm read and write anytime. pswai ? pwm halts while in wait mode 0 = allows pwm main clock generator to continue while in wait mode. 1 = halt pwm main clock generator when the part is in wait mode. centr ? center-aligned output mode to avoid irregularities in the pwm output mode, write the centr bit only when pwm channels are disabled. 0 = pwm channels operate in left-aligned output mode 1 = pwm channels operate in center-aligned output mode rdpp ? reduced drive of port p 0 = all port p output pins have normal drive capability. 1 = all port p output pins have reduced drive capability. pupp ? pull-up port p enable 0 = all port p pins have an active pull-up device disabled. 1 = all port p pins have an active pull-up device enabled. psbck ? pwm stops while in background mode 0 = allows pwm to continue while in background mode. 1 = disable pwm input clock when the part is in background mode. pwctl ? pwm control register $0054 bit 7 6 5 4 3 2 1 bit 0 0 0 0 pswai centr rdpp pupp psbck reset: 0 0 0 0 0 0 0 0
pulse-width modulator mc68hc912dt128a rev 2.0 184 pulse-width modulator motorola read anytime but write only in special mode (smodn = 0). these bits are available only in special mode and are reset in normal mode. discr ? disable reset of channel counter on write to channel counter 0 = normal operation. write to pwm channel counter will reset channel counter. 1 = write to pwm channel counter does not reset channel counter. discp ? disable compare count period 0 = normal operation 1 = in left-aligned output mode, match of period does not reset the associated pwm counter register. discal ? disable load of scale-counters on write to the associated scale-registers 0 = normal operation 1 = write to pwscal0 and pwscal1 does not load scale counters pwtst ? pwm special mode register ( ? test ? ) $0055 bit 7 6 5 4 3 2 1 bit 0 discr discp discal 0 0 0 0 0 reset: 0 0 0 0 0 0 0 0 14-pwm
pulse-width modulator pwm register descriptions mc68hc912dt128a rev 2.0 motorola pulse-width modulator 185 15-pwm portp can be read anytime. pwm functions share port p pins 3 to 0 and take precedence over the general-purpose port when enabled. when configured as input, a read will return the pin level. for port bits 7 to 4 it will read zero because there are no available external pins. when configured as output, a read will return the latched output data. for port bits 7 to 4 it will read the last value written. a write will drive associated pins only if configured for output and the corresponding pwm channel is not enabled. after reset, all pins are general-purpose, high-impedance inputs. ddrp determines pin direction of port p when used for general-purpose i/o. ddrp[7:4] ? this bits served as memory locations since there are no corresponding port pins. ddrp[3:0] ? data direction port p pin 0-3 0 = i/o pin configured as high impedance input 1 = i/o pin configured for output. portp ? port p data register $0056 bit 7 6 5 4 3 2 1 bit 0 pp7 pp6 pp5 pp4 pp3 pp2 pp1 pp0 pwm ? ? ? ? pwm3 pwm2 pwm1 pwm0 reset: ? ? ? ? ? ? ? ? ddrp ? port p data direction register $0057 bit 7 6 5 4 3 2 1 bit 0 ddp7 ddp6 ddp5 ddp4 ddp3 ddp2 ddp1 ddp0 reset: 0 0 0 0 0 0 0 0
pulse-width modulator mc68hc912dt128a rev 2.0 186 pulse-width modulator motorola pwm boundary cases the boundary conditions for the pwm channel duty registers and the pwm channel period registers cause these results: table 29 pwm left-aligned boundary conditions pwdtyx pwperx ppolx output $ff > $00 1 low $ff > $00 0 high pwperx ? 1high pwperx ? 0 low ? $00 1 high ? $00 0 low table 30 pwm center-aligned boundary conditions pwdtyx pwperx ppolx output $00 > $00 1 low $00 > $00 0 high pwperx ? 1high pwperx ? 0low ? $00 1 high ? $00 0 low 16-pwm
mc68hc912dt128a rev 2.0 motorola enhanced capture timer 187 enhanced capture timer enhanced capture timer contents introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 enhanced capture timer modes of operation . . . . . . . . . . . . . . . . . 194 timer register descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197 timer and modulus counter operation in different modes. . . . . . . . 221 introduction the hc12 enhanced capture timer module has the features of the hc12 standard timer module enhanced by additional features in order to enlarge the field of applications, in particular for automotive abs applications. the additional features permit the operation of this timer module in a mode similar to the input control timer implemented on mc68hc11nb4. these additional features are:  16-bit buffer register for four input capture (ic) channels.  four 8-bit pulse accumulators with 8-bit buffer registers associated with the four buffered ic channels. configurable also as two 16-bit pulse accumulators.  16-bit modulus down-counter with 4-bit prescaler.  four user selectable delay counters for input noise immunity increase.  main timer prescaler extended to 7-bit. 1-ect
enhanced capture timer mc68hc912dt128a rev 2.0 188 enhanced capture timer motorola this design specification describes the standard timer as well as the additional features. the basic timer consists of a 16-bit, software-programmable counter driven by a prescaler. this timer can be used for many purposes, including input waveform measurements while simultaneously generating an output waveform. pulse widths can vary from microseconds to many seconds. a full access for the counter registers or the input capture/output compare registers should take place in one clock cycle. accessing high byte and low byte separately for all of these registers may not yield the same result as accessing them in one word. 2--ect
enhanced capture timer introduction mc68hc912dt128a rev 2.0 motorola enhanced capture timer 189 figure 25 timer block diagram in latch mode 16 bit main timer pt1 comparator tc0h hold register pt0 pt3 pt2 pt4 pt5 pt6 pt7 edg0 edg1 edg2 edg3 mux prescaler m clock 16-bit load register 16-bit modulus 0 reset edg0 edg1 edg2 edg4 edg5 edg3 edg6 edg7 1, 2, ..., 128 1, 4, 8, 16 16-bit free-running latch underflow main timer prescaler tc0 capture/compare register comparator tc1 capture/compare register comparator tc2 capture/compare register comparator tc3 capture/compare register comparator tc4 capture/compare register comparator tc5 capture/compare register comparator tc6 capture/compare register comparator tc7 capture/compare register pin logic pin logic pin logic pin logic pin logic pin logic pin logic pin logic delay counter delay counter delay counter delay counter m clock tc1h hold register tc2h hold register tc3h hold register mux mux mux pa0h hold register pac0 0 reset pa1h hold register pac1 0 reset pa2h hold register pac2 0 reset pa3h hold register pac3 write $0000 to modulus counter iclat, latq, bufen (force latch) latq (mdc latch enable) down counter 3-ect
enhanced capture timer mc68hc912dt128a rev 2.0 190 enhanced capture timer motorola figure 26 timer block diagram in queue mode 16 bit main timer pt1 comparator tc0h hold register pt0 pt3 pt2 pt4 pt5 pt6 pt7 edg0 edg1 edg2 edg3 mux prescaler m clock 16-bit load register 16-bit modulus 0 reset edg0 edg1 edg2 edg4 edg5 edg3 edg6 edg7 1, 2, ..., 128 1, 4, 8, 16 16-bit free-running latch0 main timer prescaler tc0 capture/compare register comparator tc1 capture/compare register comparator tc2 capture/compare register comparator tc3 capture/compare register comparator tc4 capture/compare register comparator tc5 capture/compare register comparator tc6 capture/compare register comparator tc7 capture/compare register pin logic pin logic pin logic pin logic pin logic pin logic pin logic pin logic delay counter delay counter delay counter delay counter m clock tc1h hold register tc2h hold register tc3h hold register mux mux mux pa0h hold register pac0 0 reset pa1h hold register pac1 0 reset pa2h hold register pac2 0 reset pa3h hold register pac3 latch1 latch3 latch2 latq , bufen (queue mode) read tc3h hold register read tc2h hold register read tc1h hold register read tc0h hold register down counter 4-ect
enhanced capture timer introduction mc68hc912dt128a rev 2.0 motorola enhanced capture timer 191 figure 27 8-bit pulse accumulators block diagram host cpu data bus pt0 load holding register and reset pulse accumulator 0 0 edg3 edg2 edg1 edg0 edge detector delay counter interrupt interrupt pt1 edge detector delay counter pt2 edge detector delay counter pt3 edge detector delay counter 8-bit pac0 (pacn0) pa0h holding register 0 8-bit pac1 (pacn1) pa1h holding register 0 8-bit pac2 (pacn2) pa2h holding register 0 8-bit pac3 (pacn3) pa3h holding register 5-ect
enhanced capture timer mc68hc912dt128a rev 2.0 192 enhanced capture timer motorola figure 28 16-bit pulse accumulators block diagram edge detector 8-bit pac2 intermodule bus 8-bit pac3 pt7 pt0 m clock divide by 64 clock select clk0 clk1 4:1 mux to tcnt counter paclk paclk / 256 paclk / 65536 prescaled mclk (tmsk2 bits pr2-pr0) interrupt mux (pamod) edge detector paca delay counter (pacn3) (pacn2) 8-bit pac0 8-bit pac1 interrupt pacb (pacn1) (pacn0) 6-ect
enhanced capture timer introduction mc68hc912dt128a rev 2.0 motorola enhanced capture timer 193 7-ect figure 29 block diagram for port7 with output compare / pulse accumulator a figure 30 c3f-c0f interrupt flag setting pulse accumulator a pad (om7=1 or ol7=1) or (oc7m7 = 1) oc7 ptn edge detector delay counter 16-bit main timer tcn input capture reg. tcnh i.c. holding reg. bufen ? latq ? tfmod set cnf interrupt
enhanced capture timer mc68hc912dt128a rev 2.0 194 enhanced capture timer motorola enhanced capture timer modes of operation the enhanced capture timer has 8 input capture, output compare (ic/ oc) channels same as on the hc12 standard timer (timer channels tc0 to tc7). when channels are selected as input capture by selecting the iosx bit in tios register, they are called input capture (ic) channels. four ic channels are the same as on the standard timer with one capture register which memorizes the timer value captured by an action on the associated input pin. four other ic channels, in addition to the capture register, have also one buffer called holding register. this permits to memorize two different timer values without generation of any interrupt. four 8-bit pulse accumulators are associated with the four buffered ic channels. each pulse accumulator has a holding register to memorize their value by an action on its external input. each pair of pulse accumulators can be used as a 16-bit pulse accumulator. the 16-bit modulus down-counter can control the transfer of the ic registers contents and the pulse accumulators to the respective holding registers for a given period, every time the count reaches zero. the modulus down-counter can also be used as a stand-alone time base with periodic interrupt capability. ic channels the ic channels are composed of four standard ic registers and four buffered ic channels. an ic register is empty when it has been read or latched into the holding register. a holding register is empty when it has been read. non-buffered ic channels the main timer value is memorized in the ic register by a valid input pin transition. if the corresponding novwx bit of the icovw register is cleared, with a new occurrence of a capture, the contents of ic register are overwritten by the new value. 8-ect
enhanced capture timer enhanced capture timer modes of operation mc68hc912dt128a rev 2.0 motorola enhanced capture timer 195 9-ect if the corresponding novwx bit of the icovw register is set, the capture register cannot be written unless it is empty. this will prevent the captured value to be overwritten until it is read. buffered ic channels there are two modes of operations for the buffered ic channels.  ic latch mode: when enabled (latq=1), the main timer value is memorized in the ic register by a valid input pin transition. the value of the buffered ic register is latched to its holding register by the modulus counter for a given period when the count reaches zero, by a write $0000 to the modulus counter or by a write to iclat in the mcctl register. if the corresponding novwx bit of the icovw register is cleared, with a new occurrence of a capture, the contents of ic register are overwritten by the new value. in case of latching, the contents of its holding register are overwritten. if the corresponding novwx bit of the icovw register is set, the capture register or its holding register cannot be written by an event unless they are empty (see ic channels ). this will prevent the captured value to be overwritten until it is read or latched in the holding register.  ic queue mode: when enabled (latq=0), the main timer value is memorized in the ic register by a valid input pin transition. if the corresponding novwx bit of the icovw register is cleared, with a new occurrence of a capture, the value of the ic register will be transferred to its holding register and the ic register memorizes the new timer value. if the corresponding novwx bit of the icovw register is set, the capture register or its holding register cannot be written by an event unless they are empty (see ic channels ). in queue mode, reads of holding register will latch the corresponding pulse accumulator value to its holding register.
enhanced capture timer mc68hc912dt128a rev 2.0 196 enhanced capture timer motorola pulse accumulators there are four 8-bit pulse accumulators with four 8-bit holding registers associated with the four ic buffered channels. a pulse accumulator counts the number of active edges at the input of its channel. the user can prevent 8-bit pulse accumulators counting further than $ff by pacmx control bit in icsys ($ab). in this case a value of $ff means that 255 counts or more have occurred. each pair of pulse accumulators can be used as a 16-bit pulse accumulator. there are two modes of operation for the pulse accumulators. pulse accumulator latch mode the value of the pulse accumulator is transferred to its holding register when the modulus down-counter reaches zero, a write $0000 to the modulus counter or when the force latch control bit iclat is written. at the same time the pulse accumulator is cleared. pulse accumulator queue mode when queue mode is enabled, reads of an input capture holding register will transfer the contents of the associated pulse accumulator to its holding register. at the same time the pulse accumulator is cleared. modulus down-counter the modulus down-counter can be used as a time base to generate a periodic interrupt. it can also be used to latch the values of the ic registers and the pulse accumulators to their holding registers. the action of latching can be programmed to be periodic or only once. 10-ect
enhanced capture timer timer register descriptions mc68hc912dt128a rev 2.0 motorola enhanced capture timer 197 11-ect timer register descriptions input/output pins default to general-purpose i/o lines until an internal function which uses that pin is specifically enabled. the timer overrides the state of the ddr to force the i/o state of each associated port line when an output compare using a port line is enabled. in these cases the data direction bits will have no affect on these lines. when a pin is assigned to output an on-chip peripheral function, writing to this portt bit does not affect the pin but the data is stored in an internal latch such that if the pin becomes available for general-purpose output the driven level will be the last value written to the portt bit. read or write anytime. ios[7:0] ? input capture or output compare channel configuration 0 = the corresponding channel acts as an input capture 1 = the corresponding channel acts as an output compare. read anytime but will always return $00 (1 state is transient). write anytime. tios ? timer input capture/output compare select $0080 bit 7 6 5 4 3 2 1 bit 0 ios7 ios6 ios5 ios4 ios3 ios2 ios1 ios0 reset: 0 0 0 0 0 0 0 0 cforc ? timer compare force register $0081 bit 7 6 5 4 3 2 1 bit 0 foc7 foc6 foc5 foc4 foc3 foc2 foc1 foc0 reset: 0 0 0 0 0 0 0 0
enhanced capture timer mc68hc912dt128a rev 2.0 198 enhanced capture timer motorola foc[7:0] ? force output compare action for channel 7-0 a write to this register with the corresponding data bit(s) set causes the action which is programmed for output compare ? n ? to occur immediately. the action taken is the same as if a successful comparison had just taken place with the tcn register except the interrupt flag does not get set. read or write anytime. the bits of oc7m correspond bit-for-bit with the bits of timer port (portt). setting the oc7mn will set the corresponding port to be an output port regardless of the state of the ddrtn bit when the corresponding tiosn bit is set to be an output compare. this does not change the state of the ddrt bits. at successful oc7, for eachbit that is set in oc7m, the corresponding data bit in oc7d is stored to the corresponding bit of the timer port. note: oc7m has priority over output action on timer port enabled by omn and oln bits in tctl1 and tctl2. if an oc7m bit is set, it prevents the action of corresponding om and ol bits on the selected timer port. read or write anytime. the bits of oc7d correspond bit-for-bit with the bits of timer port (portt). when a successful oc7 compare occurs, for each bit that is set in oc7m, the corresponding data bit in oc7d is stored to the corresponding bit of the timer port. oc7m ? output compare 7 mask register $0082 bit 7 6 5 4 3 2 1 bit 0 oc7m7 oc7m6 oc7m5 oc7m4 oc7m3 oc7m2 oc7m1 oc7m0 reset: 0 0 0 0 0 0 0 0 oc7d ? output compare 7 data register $0083 bit 7 6 5 4 3 2 1 bit 0 oc7d7 oc7d6 oc7d5 oc7d4 oc7d3 oc7d2 oc7d1 oc7d0 reset: 0 0 0 0 0 0 0 0 12-ect
enhanced capture timer timer register descriptions mc68hc912dt128a rev 2.0 motorola enhanced capture timer 199 13-ect when the oc7mn bit is set, a successful oc7 action will override a successful oc[6:0] compare action during the same cycle; therefore, the ocn action taken will depend on the corresponding oc7d bit. the 16-bit main timer is an up counter. a full access for the counter register should take place in one clock cycle. a separate read/write for high byte and low byte will give a different result than accessing them as a word. read anytime. write has no meaning or effect in the normal mode; only writable in special modes (smodn = 0). the period of the first count after a write to the tcnt registers may be a different size because the write is not synchronized with the prescaler clock. read or write anytime. ten ? timer enable 0 = disables the main timer, including the counter. can be used for reducing power consumption. 1 = allows the timer to function normally. if for any reason the timer is not active, there is no 64 clock for the pulse accumulator since the e 64 is generated by the timer prescaler. tcnt ? timer count register $0084 ? $0085 bit 7 6 5 4 3 2 1 bit 0 bit 15 14 13 12 11 10 9 bit 8 bit 7 6 5 4 3 2 1 bit 0 reset: 0 0 0 0 0 0 0 0 tscr ? timer system control register $0086 bit 7 6 5 4 3 2 1 bit 0 ten tswai tsbck tffca reset: 0 0 0 0 0 0 0 0
enhanced capture timer mc68hc912dt128a rev 2.0 200 enhanced capture timer motorola tswai ? timer module stops while in wait 0 = allows the timer module to continue running during wait. 1 = disables the timer module when the mcu is in the wait mode. timer interrupts cannot be used to get the mcu out of wait. tswai also affects pulse accumulators and modulus down counters. tsbck ? timer and modulus counter stop while in background mode 0 = allows the timer and modulus counter to continue running while in background mode. 1 = disables the timer and modulus counter whenever the mcu is in background mode. this is useful for emulation. tbsck does not stop the pulse accumulator. tffca ? timer fast flag clear all 0 = allows the timer flag clearing to function normally. 1 = for tflg1($8e), a read from an input capture or a write to the output compare channel ($90 ? $9f) causes the corresponding channel flag, cnf, to be cleared. for tflg2 ($8f), any access to the tcnt register ($84, $85) clears the tof flag. any access to the pacn3 and pacn2 registers ($a2, $a3) clears the paovf and paif flags in the paflg register ($a1). any access to the pacn1 and pacn0 registers ($a4, $a5) clears the pbovf flag in the pbflg register ($b1). any access to the mccnt register ($b6, $b7) clears the mczf flag in the mcflg register ($a7). this has the advantage of eliminating software overhead in a separate clear sequence. extra care is required to avoid accidental flag clearing due to unintended accesses. 14-ect
enhanced capture timer timer register descriptions mc68hc912dt128a rev 2.0 motorola enhanced capture timer 201 15-ect read or write anytime. omn ? output mode oln ? output level these eight pairs of control bits are encoded to specify the output action to be taken as a result of a successful ocn compare. when either omn or oln is one, the pin associated with ocn becomes an output tied to ocn regardless of the state of the associated ddrt bit. note: to enable output action by omn and oln bits on timer port, the corresponding bit in oc7m should be cleared. to operate the 16-bit pulse accumulators a and b (paca and pacb) independently of input capture or output compare 7 and 0 respectively the user must set the corresponding bits iosn = 1, omn = 0 and oln = 0. oc7m7 or oc7m0 in the oc7m register must also be cleared. tqcr ? reserved $0087 bit 7 6 5 4 3 2 1 bit 0 reset: 0 0 0 0 0 0 0 0 tctl1 ? timer control register 1 $0088 bit 7 6 5 4 3 2 1 bit 0 om7 ol7 om6 ol6 om5 ol5 om4 ol4 reset: 0 0 0 0 0 0 0 0 tctl2 ? timer control register 2 $0089 bit 7 6 5 4 3 2 1 bit 0 om3 ol3 om2 ol2 om1 ol1 om0 ol0 reset: 0 0 0 0 0 0 0 0 table 31 compare result output action omn oln action 0 0 timer disconnected from output pin logic 0 1 toggle ocn output line 1 0 clear ocn output line to zero 1 1 set ocn output line to one
enhanced capture timer mc68hc912dt128a rev 2.0 202 enhanced capture timer motorola read or write anytime. edgnb, edgna ? input capture edge control these eight pairs of control bits configure the input capture edge detector circuits. read or write anytime. the bits in tmsk1 correspond bit-for-bit with the bits in the tflg1 status register. if cleared, the corresponding flag is disabled from causing a hardware interrupt. if set, the corresponding flag is enabled to cause a hardware interrupt. read or write anytime. c7i ? c0i ? input capture/output compare ? x ? interrupt enable. tctl3 ? timer control register 3 $008a bit 7 6 5 4 3 2 1 bit 0 edg7b edg7a edg6b edg6a edg5b edg5a edg4b edg4a reset: 0 0 0 0 0 0 0 0 tctl4 ? timer control register 4 $008b bit 7 6 5 4 3 2 1 bit 0 edg3b edg3a edg2b edg2a edg1b edg1a edg0b edg0a reset: 0 0 0 0 0 0 0 0 table 2 edge detector circuit configuration edgnb edgna configuration 0 0 capture disabled 0 1 capture on rising edges only 1 0 capture on falling edges only 1 1 capture on any edge (rising or falling) tmsk1 ? timer interrupt mask 1 $008c bit 7 6 5 4 3 2 1 bit 0 c7i c6i c5i c4i c3i c2i c1i c0i reset: 0 0 0 0 0 0 0 0 16-ect
enhanced capture timer timer register descriptions mc68hc912dt128a rev 2.0 motorola enhanced capture timer 203 17-ect read or write anytime. toi ? timer overflow interrupt enable 0 = interrupt inhibited 1 = hardware interrupt requested when tof flag set pupt ? timer port pull-up resistor enable this enable bit controls pull-up resistors on the timer port pins when the pins are configured as inputs. 0 = disable pull-up resistor function 1 = enable pull-up resistor function rdpt ? timer port drive reduction this bit reduces the effective output driver size which can reduce power supply current and generated noise depending upon pin loading. 0 = normal output drive capability 1 = enable output drive reduction function tcre ? timer counter reset enable this bit allows the timer counter to be reset by a successful output compare 7 event. this mode of operation is similar to an up-counting modulus counter. 0 = counter reset inhibited and counter free runs 1 = counter reset by a successful output compare 7 if tc7 = $0000 and tcre = 1, tcnt will stay at $0000 continuously. if tc7 = $ffff and tcre = 1, tof will never be set when tcnt is reset from $ffff to $0000. pr2, pr1, pr0 ? timer prescaler select these three bits specify the number of 2 stages that are to be inserted between the module clock and the main timer counter. tmsk2 ? timer interrupt mask 2 $008d bit 7 6 5 4 3 2 1 bit 0 toi 0 pupt rdpt tcre pr2 pr1 pr0 reset: 0 0 0 0 0 0 0 0
enhanced capture timer mc68hc912dt128a rev 2.0 204 enhanced capture timer motorola the newly selected prescale factor will not take effect until the next synchronized edge where all prescale counter stages equal zero. tflg1 indicates when interrupt conditions have occurred. to clear a bit in the flag register, write a one to the bit. use of the tfmod bit in the icsys register ($ab) in conjunction with the use of the icovw register ($aa) allows a timer interrupt to be generated after capturing two values in the capture and holding registers instead of generating an interrupt for every capture. read anytime. write used in the clearing mechanism (set bits cause corresponding bits to be cleared). writing a zero will not affect current status of the bit. when tffca bit in tscr register is set, a read from an input capture or a write into an output compare channel ($90 ? $9f) will cause the corresponding channel flag cnf to be cleared. c7f ? c0f ? input capture/output compare channel ? n ? flag. table 32 prescaler selection pr2 pr1 pr0 prescale factor 000 1 001 2 010 4 011 8 100 16 101 32 110 64 111 128 tflg1 ? main timer interrupt flag 1 $008e bit 7 6 5 4 3 2 1 bit 0 c7f c6f c5f c4f c3f c2f c1f c0f reset: 0 0 0 0 0 0 0 0 18-ect
enhanced capture timer timer register descriptions mc68hc912dt128a rev 2.0 motorola enhanced capture timer 205 19-ect tflg2 indicates when interrupt conditions have occurred. to clear a bit in the flag register, set the bit to one. read anytime. write used in clearing mechanism (set bits cause corresponding bits to be cleared). any access to tcnt will clear tflg2 register if the tffca bit in tscr register is set. tof ? timer overflow flag set when 16-bit free-running timer overflows from $ffff to $0000. this bit is cleared automatically by a write to the tflg2 register with bit 7 set. (see also tcre control bit explanation.) tflg2 ? main timer interrupt flag 2 $008f bit 7 6 5 4 3 2 1 bit 0 tof 0 0 0 0 0 0 0 reset: 0 0 0 0 0 0 0 0 tc0 ? timer input capture/output compare register 0 $0090 ? $0091 bit 7 6 5 4 3 2 1 bit 0 bit 15 14 13 12 11 10 9 bit 8 bit 7 6 5 4 3 2 1 bit 0 tc1 ? timer input capture/output compare register 1 $0092 ? $0093 bit 7 6 5 4 3 2 1 bit 0 bit 15 14 13 12 11 10 9 bit 8 bit 7 6 5 4 3 2 1 bit 0 tc2 ? timer input capture/output compare register 2 $0094 ? $0095 bit 7 6 5 4 3 2 1 bit 0 bit 15 14 13 12 11 10 9 bit 8 bit 7 6 5 4 3 2 1 bit 0 tc3 ? timer input capture/output compare register 3 $0096 ? $0097 bit 7 6 5 4 3 2 1 bit 0 bit 15 14 13 12 11 10 9 bit 8 bit 7 6 5 4 3 2 1 bit 0
enhanced capture timer mc68hc912dt128a rev 2.0 206 enhanced capture timer motorola depending on the tios bit for the corresponding channel, these registers are used to latch the value of the free-running counter when a defined transition is sensed by the corresponding input capture edge detector or to trigger an output action for output compare. read anytime. write anytime for output compare function. writes to these registers have no meaning or effect during input capture. all timer input capture/output compare registers are reset to $0000. 16-bit pulse accumulator a (paca) is formed by cascading the 8-bit pulse accumulators pac3 and pac2. when paen is set, the paca is enabled. the paca shares the input pin with ic7. read: any time write: any time tc4 ? timer input capture/output compare register 4 $0098 ? $0099 bit 7 6 5 4 3 2 1 bit 0 bit 15 14 13 12 11 10 9 bit 8 bit 7 6 5 4 3 2 1 bit 0 tc5 ? timer input capture/output compare register 5 $009a ? $009b bit 7 6 5 4 3 2 1 bit 0 bit 15 14 13 12 11 10 9 bit 8 bit 7 6 5 4 3 2 1 bit 0 tc6 ? timer input capture/output compare register 6 $009c ? $009d bit 7 6 5 4 3 2 1 bit 0 bit 15 14 13 12 11 10 9 bit 8 bit 7 6 5 4 3 2 1 bit 0 tc7 ? timer input capture/output compare register 7 $009e ? $009f bit 7 6 5 4 3 2 1 bit 0 bit 15 14 13 12 11 10 9 bit 8 bit 7 6 5 4 3 2 1 bit 0 pactl ? 16-bit pulse accumulator a control register $00a0 bit 7 6 5 4 3 2 1 bit 0 0 paen pamod pedge clk1 clk0 paovi pai reset: 0 0 0 0 0 0 0 0 20-ect
enhanced capture timer timer register descriptions mc68hc912dt128a rev 2.0 motorola enhanced capture timer 207 21-ect paen ? pulse accumulator a system enable 0 = 16-bit pulse accumulator a system disabled. 8-bit pac3 and pac2 can be enabled when their related enable bits in icpacr ($a8) are set. pulse accumulator input edge flag (paif) function is disabled. 1 = pulse accumulator a system enabled. the two 8-bit pulse accumulators pac3 and pac2 are cascaded to form the paca 16-bit pulse accumulator. when paca in enabled, the pacn3 and pacn2 registers contents are respectively the high and low byte of the paca. pa3en and pa2en control bits in icpacr ($a8) have no effect. pulse accumulator input edge flag (paif) function is enabled. paen is independent from ten. with timer disabled, the pulse accumulator can still function unless pulse accumulator is disabled. pamod ? pulse accumulator mode 0 = event counter mode 1 = gated time accumulation mode pedge ? pulse accumulator edge control for pamod bit = 0 (event counter mode). 0 = falling edges on pt7 pin cause the count to be incremented 1 = rising edges on pt7 pin cause the count to be incremented for pamod bit = 1 (gated time accumulation mode). 0 = pt7 input pin high enables m divided by 64 clock to pulse accumulator and the trailing falling edge on pt7 sets the paif flag. 1 = pt7 input pin low enables m divided by 64 clock to pulse accumulator and the trailing rising edge on pt7 sets the paif flag. if the timer is not active (ten = 0 in tscr), there is no divide-by-64 since the e 64 clock is generated by the timer prescaler. pamod pedge pin action 0 0 falling edge 0 1 rising edge 1 0 div. by 64 clock enabled with pin high level 1 1 div. by 64 clock enabled with pin low level
enhanced capture timer mc68hc912dt128a rev 2.0 208 enhanced capture timer motorola clk1, clk0 ? clock select bits if the pulse accumulator is disabled (paen = 0), the prescaler clock from the timer is always used as an input clock to the timer counter. the change from one selected clock to the other happens immediately after these bits are written. paovi ? pulse accumulator a overflow interrupt enable 0 = interrupt inhibited 1 = interrupt requested if paovf is set pai ? pulse accumulator input interrupt enable 0 = interrupt inhibited 1 = interrupt requested if paif is set read or write anytime. when the tffca bit in the tscr register is set, any access to the pacnt register will clear all the flags in the paflg register. paovf ? pulse accumulator a overflow flag set when the 16-bit pulse accumulator a overflows from $ffff to $0000,or when 8-bit pulse accumulator 3 (pac3) overflows from $ff to $00. this bit is cleared automatically by a write to the paflg register with bit 1 set. clk1 clk0 clock source 0 0 use timer prescaler clock as timer counter clock 0 1 use paclk as input to timer counter clock 1 0 use paclk/256 as timer counter clock frequency 11 use paclk/65536 as timer counter clock frequency paflg ? pulse accumulator a flag register $00a1 bit 7 6 5 4 3 2 1 bit 0 0 0 0 0 0 0 paovf paif reset: 0 0 0 0 0 0 0 0 22-ect
enhanced capture timer timer register descriptions mc68hc912dt128a rev 2.0 motorola enhanced capture timer 209 23-ect paif ? pulse accumulator input edge flag set when the selected edge is detected at the pt7 input pin. in event mode the event edge triggers paif and in gated time accumulation mode the trailing edge of the gate signal at the pt7 input pin triggers paif. this bit is cleared by a write to the paflg register with bit 0 set. any access to the pacn3, pacn2 registers will clear all the flags in this register when tffca bit in register tscr($86) is set. read or write any time. the two 8-bit pulse accumulators pac3 and pac2 are cascaded to form the paca 16-bit pulse accumulator. when paca in enabled (paen=1 in pactl, $a0) the pacn3 and pacn2 registers contents are respectively the high and low byte of the paca. when pacn3 overflows from $ff to $00, the interrupt flag paovf in paflg ($a1) is set. full count register access should take place in one clock cycle. a separate read/write for high byte and low byte will give a different result than accessing them as a word. read or write any time. pacn3, pacn2 ? pulse accumulators count registers $00a2, $00a3 bit 7 6 5 4 3 2 1 bit 0 $00a2 bit 7 6 5 4 3 2 1 bit 0 pacn3 (hi) $00a3 bit 7 6 5 4 3 2 1 bit 0 pacn2 (lo) reset: 0 0 0 0 0 0 0 0 pacn1, pacn0 ? pulse accumulators count registers $00a4, $00a5 bit 7 6 5 4 3 2 1 bit 0 $00a4 bit 7 6 5 4 3 2 1 bit 0 pacn1 (hi) $00a5 bit 7 6 5 4 3 2 1 bit 0 pacn0 (lo) reset: 0 0 0 0 0 0 0 0
enhanced capture timer mc68hc912dt128a rev 2.0 210 enhanced capture timer motorola the two 8-bit pulse accumulators pac1 and pac0 are cascaded to form the pacb 16-bit pulse accumulator. when pacb in enabled, (pben=1 in pbctl, $b0) the pacn1 and pacn0 registers contents are respectively the high and low byte of the pacb. when pacn1 overflows from $ff to $00, the interrupt flag pbovf in pbflg ($b1) is set. full count register access should take place in one clock cycle. a separate read/write for high byte and low byte will give a different result than accessing them as a word. read or write any time. mczi ? modulus counter underflow interrupt enable 0 = modulus counter interrupt is disabled. 1 = modulus counter interrupt is enabled. modmc ? modulus mode enable 0 = the counter counts once from the value written to it and will stop at $0000. 1 = modulus mode is enabled. when the counter reaches $0000, the counter is loaded with the latest value written to the modulus count register. note: for proper operation, the mcen bit should be cleared before modifying the modmc bit in order to reset the modulus counter to $ff. rdmcl ? read modulus down-counter load 0 = reads of the modulus count register will return the present value of the count register. 1 = reads of the modulus count register will return the contents of the load register. mcctl ? 16-bit modulus down-counter control register $00a6 bit 7 6 5 4 3 2 1 bit 0 mczi modmc rdmcl iclat flmc mcen mcpr1 mcpr0 reset: 0 0 0 0 0 0 0 0 24-ect
enhanced capture timer timer register descriptions mc68hc912dt128a rev 2.0 motorola enhanced capture timer 211 25-ect iclat ? input capture force latch action when input capture latch mode is enabled (latq and bufen bit in icsys ($ab) are set), a write one to this bit immediately forces the contents of the input capture registers tc0 to tc3 and their corresponding 8-bit pulse accumulators to be latched into the associated holding registers. the pulse accumulators will be automatically cleared when the latch action occurs. writing zero to this bit has no effect. read of this bit will return always zero. flmc ? force load register into the modulus counter count register this bit is active only when the modulus down-counter is enabled (mcen=1). a write one into this bit loads the load register into the modulus counter count register. this also resets the modulus counter prescaler. write zero to this bit has no effect. when modmc=0, counter starts counting and stops at $0000. read of this bit will return always zero. mcen ? modulus down-counter enable 0 = modulus counter disabled. 1 = modulus counter is enabled. when mcen=0, the counter is preset to $ffff. this will prevent an early interrupt flag when the modulus down-counter is enabled. mcpr1, mcpr0 ? modulus counter prescaler select these two bits specify the division rate of the modulus counter prescaler. the newly selected prescaler division rate will not be effective until a load of the load register into the modulus counter count register occurs. mcpr1 mcpr0 prescaler division rate 00 1 01 4 10 8 11 16
enhanced capture timer mc68hc912dt128a rev 2.0 212 enhanced capture timer motorola read: any time write: only for clearing bit 7 mczf ? modulus counter underflow interrupt flag the flag is set when the modulus down-counter reaches $0000. a write one to this bit clears the flag. write zero has no effect. any access to the mccnt register will clear the mczf flag in this register when tffca bit in register tscr($86) is set. polf3 ? polf0 ? first input capture polarity status this are read only bits. write to these bits has no effect. each status bit gives the polarity of the first edge which has caused an input capture to occur after capture latch has been read. each polfx corresponds to a timer portx input. 0 = the first input capture has been caused by a falling edge. 1 = the first input capture has been caused by a rising edge. the 8-bit pulse accumulators pac3 and pac2 can be enabled only if paen in patcl ($a0) is cleared. if paen is set, pa3en and pa2en have no effect. the 8-bit pulse accumulators pac1 and pac0 can be enabled only if pben in pbtcl ($b0) is cleared. if pben is set, pa1en and pa0en have no effect. read or write any time. mcflg ? 16-bit modulus down-counter flag register $00a7 bit 7 6 5 4 3 2 1 bit 0 mczf 0 0 0 polf3 polf2 polf1 polf0 reset: 0 0 0 0 0 0 0 0 icpar ? input control pulse accumulators register $00a8 bit 7 6 5 4 3 2 1 bit 0 0 0 0 0 pa3en pa2en pa1en pa0en reset: 0 0 0 0 0 0 0 0 26-ect
enhanced capture timer timer register descriptions mc68hc912dt128a rev 2.0 motorola enhanced capture timer 213 27-ect paxen ? 8-bit pulse accumulator ? x ? enable 0 = 8-bit pulse accumulator is disabled. 1 = 8-bit pulse accumulator is enabled. read or write any time. if enabled, after detection of a valid edge on input capture pin, the delay counter counts the pre-selected number of m clock (module clock) cycles, then it will generate a pulse on its output. the pulse is generated only if the level of input signal, after the preset delay, is the opposite of the level before the transition.this will avoid reaction to narrow input pulses. after counting, the counter will be cleared automatically. delay between two active edges of the input signal period should be longer than the selected counter delay. dlyx ? delay counter select read or write any time. dlyct ? delay counter control register $00a9 bit 7 6 5 4 3 2 1 bit 0 0 0 0 0 0 0 dly1 dly0 reset: 0 0 0 0 0 0 0 0 dly1 dly0 delay 0 0 disabled (bypassed) 0 1 256m clock cycles 1 0 512m clock cycles 1 1 1024 m clock cycles icovw ? input control overwrite register $00aa bit 7 6 5 4 3 2 1 bit 0 novw7 novw6 novw5 novw4 novw3 novw2 novw1 novw0 reset: 0 0 0 0 0 0 0 0
enhanced capture timer mc68hc912dt128a rev 2.0 214 enhanced capture timer motorola an ic register is empty when it has been read or latched into the holding register. a holding register is empty when it has been read. novwx ? no input capture overwrite 0 = the contents of the related capture register or holding register can be overwritten when a new input capture or latch occurs. 1 = the related capture register or holding register cannot be written by an event unless they are empty (see ic channels ). this will prevent the captured value to be overwritten until it is read or latched in the holding register. read: any time write: may be written once (smodn=1). writes are always permitted when smodn=0. shxy ? share input action of input capture channels x and y 0 = normal operation 1 = the channel input ? x ? causes the same action on the channel ? y ? . the port pin ? x ? and the corresponding edge detector is used to be active on the channel ? y ? . tfmod ? timer flag-setting mode use of the tfmod bit in the icsys register ($ab) in conjunction with the use of the icovw register ($aa) allows a timer interrupt to be generated after capturing two values in the capture and holding registers instead of generating an interrupt for every capture. by setting tfmod in queue mode, when novw bit is set and the corresponding capture and holding registers are emptied, an input capture event will first update the related input capture register with icsys ? input control system control register $00ab bit 7 6 5 4 3 2 1 bit 0 sh37 sh26 sh15 sh04 tfmod pacmx bufen latq reset: 0 0 0 0 0 0 0 0 28-ect
enhanced capture timer timer register descriptions mc68hc912dt128a rev 2.0 motorola enhanced capture timer 215 29-ect the main timer contents. at the next event the tcn data is transferred to the tcnh register, the tcn is updated and the cnf interrupt flag is set. see figure 30 . in all other input capture cases the interrupt flag is set by a valid external event on ptn. 0 = the timer flags c3f ? c0f in tflg1 ($8e) are set when a valid input capture transition on the corresponding port pin occurs. 1 = if in queue mode (bufen=1 and latq=0), the timer flags c3f ? c0f in tflg1 ($8e) are set only when a latch on the corresponding holding register occurs. if the queue mode is not engaged, the timer flags c3f ? c0f are set the same way as for tfmod=0. pacmx ? 8-bit pulse accumulators maximum count 0 = normal operation. when the 8-bit pulse accumulator has reached the value $ff, with the next active edge, it will be incremented to $00. 1 = when the 8-bit pulse accumulator has reached the value $ff, it will not be incremented further. the value $ff indicates a count of 255 or more. bufen ? ic buffer enable 0 = input capture and pulse accumulator holding registers are disabled. 1 = input capture and pulse accumulator holding registers are enabled. the latching mode is defined by latq control bit. write one into iclat bit in mcctl ($a6), when latq is set will produce latching of input capture and pulse accumulators registers into their holding registers. latq ? input control latch or queue mode enable the bufen control bit should be set in order to enable the ic and pulse accumulators holding registers. otherwise latq latching modes are disabled. write one into iclat bit in mcctl ($a6), when latq and bufen are set will produce latching of input capture and pulse accumulators registers into their holding registers.
enhanced capture timer mc68hc912dt128a rev 2.0 216 enhanced capture timer motorola 0 = queue mode of input capture is enabled. the main timer value is memorized in the ic register by a valid input pin transition. with a new occurrence of a capture, the value of the ic register will be transferred to its holding register and the ic register memorizes the new timer value. 1 = latch mode is enabled. latching function occurs when modulus down-counter reaches zero or a zero is written into the count register mccnt (see buffered ic channels ). with a latching event the contents of ic registers and 8-bit pulse accumulators are transferred to their holding registers. 8-bit pulse accumulators are cleared. read: any time write: only in special mode (smod = 1). tcbyp ? main timer divider chain bypass 0 = normal operation 1 = for testing only. the 16-bit free-running timer counter is divided into two 8-bit halves and the prescaler is bypassed. the clock drives both halves directly. when the high byte of timer counter tcnt ($84) overflows from $ff to $00, the tof flag in tflg2 ($8f) will be set. read: any time (inputs return pin level; outputs return data register contents) timtst ? timer test register $00ad bit 7 6 5 4 3 2 1 bit 0 0 0 0 0 0 0 tcbyp 0 reset: 0 0 0 0 0 0 0 0 portt ? timer port data register $00ae bit 7 6 5 4 3 2 1 bit 0 port pt7 pt6 pt5 pt4 pt3 pt2 pt1 pt0 timer i/oc7 i/oc6 i/oc5 i/oc4 i/oc3 i/oc2 i/oc1 i/oc0 reset: - - - - - - - - 30-ect
enhanced capture timer timer register descriptions mc68hc912dt128a rev 2.0 motorola enhanced capture timer 217 31-ect write: data stored in an internal latch (drives pins only if configured for output) since the output compare 7 shares the pin with pulse accumulator input, the only way for pulse accumulator to receive an independent input from output compare 7 is setting both om7 & ol7 to be zero, and also oc7m7 in oc7m register to be zero. oc7 is still able to reset the counter if enabled while pt7 is used as input to pulse accumulator. portt can be read anytime. when configured as an input, a read will return the pin level. when configured as an output, a read will return the latched output data. note: writes do not change pin state when the pin is configured for timer output. the minimum pulse width for pulse accumulator input should always be greater than the width of two module clocks due to input synchronizer circuitry. the minimum pulse width for the input capture should always be greater than the width of two module clocks due to input synchronizer circuitry. read or write any time. 0 = configures the corresponding i/o pin for input only 1 = configures the corresponding i/o pin for output. the timer forces the i/o state to be an output for each timer port line associated with an enabled output compare. in these cases the data direction bits will not be changed, but have no effect on the direction of these pins. the ddrt will revert to controlling the i/o direction of a pin when the associated timer output compare is disabled. input captures do not override the ddrt settings. ddrt ? data direction register for timer port $00af bit 7 6 5 4 3 2 1 bit 0 ddt7 ddt6 ddt5 ddt4 ddt3 ddt2 ddt1 ddt0 reset: 0 0 0 0 0 0 0 0
enhanced capture timer mc68hc912dt128a rev 2.0 218 enhanced capture timer motorola read or write any time. 16-bit pulse accumulator b (pacb) is formed by cascading the 8-bit pulse accumulators pac1 and pac0. when pben is set, the pacb is enabled. the pacb shares the input pin with ic0. pben ? pulse accumulator b system enable 0 = 16-bit pulse accumulator system disabled. 8-bit pac1 and pac0 can be enabled when their related enable bits in icpacr ($a8) are set. 1 = pulse accumulator b system enabled. the two 8-bit pulse accumulators pac1 and pac0 are cascaded to form the pacb 16-bit pulse accumulator. when pacb in enabled, the pacn1 and pacn0 registers contents are respectively the high and low byte of the pacb. pa1en and pa0en control bits in icpacr ($a8) have no effect. pben is independent from ten. with timer disabled, the pulse accumulator can still function unless pulse accumulator is disabled. pbovi ? pulse accumulator b overflow interrupt enable 0 = interrupt inhibited 1 = interrupt requested if pbovf is set read or write any time. pbctl ? 16-bit pulse accumulator b control register $00b0 bit 7 6 5 4 3 2 1 bit 0 0 pben 0 0 0 0 pbovi 0 reset: 0 0 0 0 0 0 0 0 pbflg ? pulse accumulator b flag register $00b1 bit 7 6 5 4 3 2 1 bit 0 0 0 0 0 0 0 pbovf 0 reset: 0 0 0 0 0 0 0 0 32-ect
enhanced capture timer timer register descriptions mc68hc912dt128a rev 2.0 motorola enhanced capture timer 219 33-ect pbovf ? pulse accumulator b overflow flag this bit is set when the 16-bit pulse accumulator b overflows from $ffff to $0000, or when 8-bit pulse accumulator 1 (pac1) overflows from $ff to $00. this bit is cleared by a write to the pbflg register with bit 1 set. any access to the pacn1 and pacn0 registers will clear the pbovf flag in this register when tffca bit in register tscr($86) is set. read: any time write: has no effect. these registers are used to latch the value of the corresponding pulse accumulator when the related bits in register icpar ($a8) are enabled (see pulse accumulators ). read or write any time. a full access for the counter register should take place in one clock cycle. a separate read/write for high byte and low byte will give different result than accessing them as a word. if the rdmcl bit in mcctl register is cleared, reads of the mccnt register will return the present value of the count register. if the rdmcl pa3h ? pa0h ? 8-bit pulse accumulators holding registers $00b2 ? $00b5 bit 7 6 5 4 3 2 1 bit 0 $00b2 bit 7 6 5 4 3 2 1 bit 0 pa3h $00b3 bit 7 6 5 4 3 2 1 bit 0 pa2h $00b4 bit 7 6 5 4 3 2 1 bit 0 pa1h $00b5 bit 7 6 5 4 3 2 1 bit 0 pa0h reset: 0 0 0 0 0 0 0 0 mccnt ? modulus down-counter count register $00b6, $00b7 bit 7 6 5 4 3 2 1 bit 0 $00b6 bit 15 14 13 12 11 10 9 bit 8 mccnth $00b7 bit 7 6 5 4 3 2 1 bit 0 mccntl reset: 1 1 1 1 1 1 1 1
enhanced capture timer mc68hc912dt128a rev 2.0 220 enhanced capture timer motorola bit is set, reads of the mccnt will return the contents of the load register. if a $0000 is written into mccnt and modulus counter while latq and bufen in icsys ($ab) register are set, the input capture and pulse accumulator registers will be latched. with a $0000 write to the mccnt, the modulus counter will stay at zero and does not set the mczf flag in mcflg register. if modulus mode is enabled (modmc=1), a write to this address will update the load register with the value written to it. the count register will not be updated with the new value until the next counter underflow. the flmc bit in mcctl ($a6) can be used to immediately update the count register with the new value if an immediate load is desired. if modulus mode is not enabled (modmc=0), a write to this address will clear the prescaler and will immediately update the counter register with the value written to it and down-counts once to $0000. tc0h ? timer input capture holding register 0 $00b8 ? $00b9 bit 7 6 5 4 3 2 1 bit 0 bit 15 14 13 12 11 10 9 bit 8 bit 7 6 5 4 3 2 1 bit 0 tc1h ? timer input capture holding register 1 $00ba ? $00bb bit 7 6 5 4 3 2 1 bit 0 bit 15 14 13 12 11 10 9 bit 8 bit 7 6 5 4 3 2 1 bit 0 tc2h ? timer input capture holding register 2 $00bc ? $00bd bit 7 6 5 4 3 2 1 bit 0 bit 15 14 13 12 11 10 9 bit 8 bit 7 6 5 4 3 2 1 bit 0 tc3h ? timer input capture holding register 3 $00be ? $00bf bit 7 6 5 4 3 2 1 bit 0 bit 15 14 13 12 11 10 9 bit 8 bit 7 6 5 4 3 2 1 bit 0 34-ect
enhanced capture timer timer and modulus counter operation in different modes mc68hc912dt128a rev 2.0 motorola enhanced capture timer 221 35-ect read: any time write: has no effect. these registers are used to latch the value of the input capture registers tc0 ? tc3. the corresponding iosx bits in tios ($80) should be cleared (see ic channels ). timer and modulus counter operation in different modes stop: timer and modulus counter are off since clocks are stopped. bgdm: timer and modulus counter keep on running, unless tsbck (reg$86, bit5) is set to one. wait: counters keep on running, unless tswai in tscr ($86) is set to one. normal: timer and modulus counter keep on running, unless ten in tscr($86) respectively mcen in mcctl ($a6) are cleared. ten=0: all 16-bit timer operations are stopped, can only access the registers. mcen=0: modulus counter is stopped. paen=1: 16-bit pulse accumulator a is active. paen=0: 8-bit pulse accumulators 3 and 2 can be enabled. (see icpar) pben=1: 16-bit pulse accumulator b is active. pben=0: 8-bit pulse accumulators 1 and 0 can be enabled. (see icpar)
enhanced capture timer mc68hc912dt128a rev 2.0 222 enhanced capture timer motorola 36-ect
mc68hc912dt128a rev 2.0 motorola multiple serial interface 223 multiple serial interface multiple serial interface contents introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223 block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224 serial communication interface (sci). . . . . . . . . . . . . . . . . . . . . . . . 224 serial peripheral interface (spi) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235 port s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245 introduction the multiple serial interface (msi) module consists of three independent serial i/o sub-systems: two serial communication interfaces (sci0 and sci1) and the serial peripheral interface (spi). each serial pin shares function with the general-purpose port pins of port s. the sci subsystems are nrz type systems that are compatible with standard rs-232 systems. these sci systems have a new single wire operation mode which allows the unused pin to be available as general-purpose i/ o. the spi subsystem, which is compatible with the m68hc11 spi, includes new features such as ss output and bidirectional mode. 1-msi
multiple serial interface mc68hc912dt128a rev 2.0 224 multiple serial interface motorola block diagram figure 31 multiple serial interface block diagram serial communication interface (sci) two serial communication interfaces are available on the mc68hc912dt128a. these are nrz format (one start, eight or nine data, and one stop bit) asynchronous communication systems with independent internal baud rate generation circuitry and sci transmitters and receivers. they can be configured for eight or nine data bits (one of which may be designated as a parity bit, odd or even). if enabled, parity is generated in hardware for transmitted and received data. receiver parity errors are flagged in hardware. the baud rate generator is based on a modulus counter, allowing flexibility in choosing baud rates. there is a receiver wake-up feature, an idle line detect feature, a loop-back mode, and various error detection features. two port pins for each sci provide the external interface for the transmitted data (txd) and the received data (rxd). for a faster wake-up out of wait mode by a received sci message, both sci have the capability of sending a receiver interrupt, if enabled, when raf (receiver active flag) is set. for compatibility with other ps0 ps1 ps2 ps3 ps4 ps5 ps6 ps7 sci0 sci1 spi ddrs/ioctlr port s i/o drivers msi rxd0 txd0 rxd1 txd1 miso/siso mosi/momi sck cs /ss hc12a4 msi block 2--msi
multiple serial interface serial communication interface (sci) mc68hc912dt128a rev 2.0 motorola multiple serial interface 225 m68hc12 products, this feature is active only in wait mode and is disabled when vddpll supply is at v ss level. figure 32 serial communications interface block diagram data format the serial data format requires the following conditions:  an idle-line in the high state before transmission or reception of a message. rx baud rate tx baud rate mclk divider 10-11 bit shift reg msb txd buffer/scxdrl txmtr control scxcr2/sci ctl 2 scxcr1/sci ctl 1 scxsr1/int status data recovery 10-11 bit shift reg txd buffer/scxdrl scxbd/select lsb rxd txd pin control / ddrs / port s wake-up logic scxcr1/sci ctl 1 scxsr1/int status scxcr2/sci ctl 2 int request logic msb lsb int request logic sci receiver sci transmitter baud rate clock to internal logic data bus parity detect parity generator hc12a4 sci block 3-msi
multiple serial interface mc68hc912dt128a rev 2.0 226 multiple serial interface motorola  a start bit (logic zero), transmitted or received, that indicates the start of each character.  data that is transmitted or received least significant bit (lsb) first.  a stop bit (logic one), used to indicate the end of a frame. (a frame consists of a start bit, a character of eight or nine data bits and a stop bit.)  a break is defined as the transmission or reception of a logic zero for one frame or more.  this sci supports hardware parity for transmit and receive. sci baud rate generation the basis of the sci baud rate generator is a 13-bit modulus counter. this counter gives the generator the flexibility necessary to achieve a reasonable level of independence from the cpu operating frequency and still be able to produce standard baud rates with a minimal amount of error. the clock source for the generator comes from the m clock. sci register descriptions control and data registers for the sci subsystem are described below. the memory address indicated for each register is the default address that is in use after reset. both sci have identical control registers mapped in two blocks of eight bytes. table 33 baud rate generation desired sci baud rate br divisor for m = 4.0 mhz br divisor for m = 8.0 mhz 110 2273 4545 300 833 2273 600 417 833 1200 208 417 2400 104 208 4800 52 104 9600 26 52 14400 17 35 19200 13 26 38400 ? 13 4-msi
multiple serial interface serial communication interface (sci) mc68hc912dt128a rev 2.0 motorola multiple serial interface 227 scxbdh and scxbdl are considered together as a 16-bit baud rate control register. read any time. write sbr[12:0] anytime. low order byte must be written for change to take effect. write sbr[15:13] only in special modes. the value in sbr[12:0] determines the baud rate of the sci. the desired baud rate is determined by the following formula: which is equivalent to: br is the value written to bits sbr[12:0] to establish baud rate. note: the baud rate generator is disabled until te or re bit in scxcr2 register is set for the first time after reset, and/or the baud rate generator is disabled when sbr[12:0] = 0. btst ? reserved for test function bspl ? reserved for test function brld ? reserved for test function sc0bdh/sc1bdh ? sci baud rate control register $00c0/$00c8 bit 7654321bit 0 btst bspl brld sbr12 sbr11 sbr10 sbr9 sbr8 high reset: 0 0000000 sc0bdl/sc1bdl ? sci baud rate control register $00c1/$00c9 bit 7654321bit 0 sbr7 sbr6 sbr5 sbr4 sbr3 sbr2 sbr1 sbr0 low reset: 0 0000100 sci baud rate mclk 16 br ?? 5-msi
multiple serial interface mc68hc912dt128a rev 2.0 228 multiple serial interface motorola read or write anytime. loops ? sci loop mode/single wire mode enable 0 = sci transmit and receive sections operate normally. 1 = sci receive section is disconnected from the rxd pin and the rxd pin is available as general purpose i/o. the receiver input is determined by the rsrc bit. the transmitter output is controlled by the associated ddrs bit. both the transmitter and the receiver must be enabled to use the loop or the single wire mode. if the ddrs bit associated with the txd pin is set during the loops = 1, the txd pin outputs the sci waveform. if the ddrs bit associated with the txd pin is clear during the loops = 1, the txd pin becomes high (idle line state) for rsrc = 0 and high impedance for rsrc = 1. refer to table 34 . woms ? wired-or mode for serial pins this bit controls the two pins (txd and rxd) associated with the scix section. 0 = pins operate in a normal mode with both high and low drive capability. to affect the rxd bit, that bit would have to be configured as an output (via ddrs0/2) which is the single wire case when using the sci. woms bit still affects general-purpose output on txd and rxd pins when scix is not using these pins. 1 = each pin operates in an open drain fashion if that pin is declared as an output . sc0cr1/sc1cr1 ? sci control register 1 $00c2/$00ca bit 7654321bit 0 loops woms rsrc m wake ilt pe pt reset: 0 0000000 6-msi
multiple serial interface serial communication interface (sci) mc68hc912dt128a rev 2.0 motorola multiple serial interface 229 7-msi rsrc ? receiver source when loops = 1, the rsrc bit determines the internal feedback path for the receiver. 0 = receiver input is connected to the transmitter internally (not txd pin) 1 = receiver input is connected to the txd pin m ? mode (select character format) 0 = one start, eight data, one stop bit 1 = one start, eight data, ninth data, one stop bit wake ? wake-up by address mark/idle 0 = wake up by idle line recognition 1 = wake up by address mark (last data bit set) ilt ? idle line type determines which of two types of idle line detection will be used by the sci receiver. 0 = short idle line mode is enabled. 1 = long idle line mode is detected. in the short mode, the sci circuitry begins counting ones in the search for the idle line condition immediately after the start bit. this means that the stop bit and any bits that were ones before the stop bit could be counted in that string of ones, resulting in earlier recognition of an idle line. table 34 loop mode functions loops rsrc ddrs1(3) woms function of port s bit 1/3 0 x x x normal operations 1 0 0 0/1 loop mode without txd output(txd = high impedance) 1 0 1 1 loop mode with txd output (cmos) 1 0 1 1 loop mode with txd output (open-drain) 11 0 x single wire mode without txd output (the pin is used as receiver input only, txd = high impedance) 11 1 0 single wire mode with txd output (the output is also fed back to receiver input, cmos) 1 1 1 1 single wire mode for the receiving and transmitting(open-drain)
multiple serial interface mc68hc912dt128a rev 2.0 230 multiple serial interface motorola in the long mode, the sci circuitry does not begin counting ones in the search for the idle line condition until a stop bit is received. therefore, the last byte ? s stop bit and preceding ? 1 ? bits do not affect how quickly an idle line condition can be detected. pe ? parity enable 0 = parity is disabled. 1 = parity is enabled. pt ? parity type if parity is enabled, this bit determines even or odd parity for both the receiver and the transmitter. 0 = even parity is selected. an even number of ones in the data character causes the parity bit to be zero and an odd number of ones causes the parity bit to be one. 1 = odd parity is selected. an odd number of ones in the data character causes the parity bit to be zero and an even number of ones causes the parity bit to be one. read or write anytime. tie ? transmit interrupt enable 0 = tdre interrupts disabled 1 = sci interrupt will be requested whenever the tdre status flag is set. tcie ? transmit complete interrupt enable 0 = tc interrupts disabled 1 = sci interrupt will be requested whenever the tc status flag is set. sc0cr2/sc1cr2 ? sci control register 2 $00c3/$00cb bit 7654321bit 0 tie tcie rie ilie te re rwu sbk reset: 0 0000000 8-msi
multiple serial interface serial communication interface (sci) mc68hc912dt128a rev 2.0 motorola multiple serial interface 231 9-msi rie ? receiver interrupt enable 0 = rdrf and or interrupts disabled, raf interrupt in wait mode disabled 1 = sci interrupt will be requested whenever the rdrf or or status flag is set, or when raf is set while in wait mode with vddpll high. ilie ? idle line interrupt enable 0 = idle interrupts disabled 1 = sci interrupt will be requested whenever the idle status flag is set. te ? transmitter enable 0 = transmitter disabled 1 = sci transmit logic is enabled and the txd pin (port s bit 1/bit 3) is dedicated to the transmitter. the te bit can be used to queue an idle preamble. re ? receiver enable 0 = receiver disabled 1 = enables the sci receive circuitry. rwu ? receiver wake-up control 0 = normal sci receiver 1 = enables the wake-up function and inhibits further receiver interrupts. normally hardware wakes the receiver by automatically clearing this bit. sbk ? send break 0 = break generator off 1 = generate a break code (at least 10 or 11 contiguous zeros). as long as sbk remains set the transmitter will send zeros. when sbk is changed to zero, the current frame of all zeros is finished before the txd line goes to the idle state. if sbk is toggled on and off, the transmitter will send only 10 (or 11) zeros and then revert to mark idle or sending data.
multiple serial interface mc68hc912dt128a rev 2.0 232 multiple serial interface motorola the bits in these registers are set by various conditions in the sci hardware and are automatically cleared by special acknowledge sequences. the receive related flag bits in scxsr1 (rdrf, idle, or, nf, fe, and pf) are all cleared by a read of the scxsr1 register followed by a read of the transmit/receive data register low byte. however, only those bits which were set when scxsr1 was read will be cleared by the subsequent read of the transmit/receive data register low byte. the transmit related bits in scxsr1 (tdre and tc) are cleared by a read of the scxsr1 register followed by a write to the transmit/receive data register low byte. read anytime (used in auto clearing mechanism). write has no meaning or effect. tdre ? transmit data register empty flag new data will not be transmitted unless scxsr1 is read before writing to the transmit data register. reset sets this bit. 0 = scxdr busy 1 = any byte in the transmit data register is transferred to the serial shift register so new data may now be written to the transmit data register. tc ? transmit complete flag flag is set when the transmitter is idle (no data, preamble, or break transmission in progress). clear by reading scxsr1 with tc set and then writing to scxdr. 0 = transmitter busy 1 = transmitter is idle sc0sr1/sc1sr1 ? sci status register 1 $00c4/$00cc bit 7654321bit 0 tdre tc rdrf idle or nf fe pf reset: 1 1000000 10-msi
multiple serial interface serial communication interface (sci) mc68hc912dt128a rev 2.0 motorola multiple serial interface 233 11-msi rdrf ? receive data register full flag once cleared, idle is not set again until the rxd line has been active and becomes idle again. rdrf is set if a received character is ready to be read from scxdr. clear the rdrf flag by reading scxsr1 with rdrf set and then reading scxdr. 0 = scxdr empty 1 = scxdr full idle ? idle line detected flag receiver idle line is detected (the receipt of a minimum of 10/11 consecutive ones). this bit will not be set by the idle line condition when the rwu bit is set. once cleared, idle will not be set again until after rdrf has been set (after the line has been active and becomes idle again). 0 = rxd line is idle 1 = rxd line is active or ? overrun error flag new byte is ready to be transferred from the receive shift register to the receive data register and the receive data register is already full (rdrf bit is set). data transfer is inhibited until this bit is cleared. 0 = no overrun 1 = overrun detected nf ? noise error flag set during the same cycle as the rdrf bit but not set in the case of an overrun (or). 0 = unanimous decision 1 = noise on a valid start bit, any of the data bits, or on the stop bit fe ? framing error flag set when a zero is detected where a stop bit was expected. clear the fe flag by reading scxsr1 with fe set and then reading scxdr. 0 = stop bit detected 1 = zero detected rather than a stop bit
multiple serial interface mc68hc912dt128a rev 2.0 234 multiple serial interface motorola pf ? parity error flag indicates if received data ? s parity matches parity bit. this feature is active only when parity is enabled. the type of parity tested for is determined by the pt (parity type) bit in scxcr1. 0 = parity correct 1 = incorrect parity detected read anytime. write has no meaning or effect. raf ? receiver active flag this bit is controlled by the receiver front end. it is set during the rt1 time period of the start bit search. it is cleared when an idle state is detected or when the receiver circuitry detects a false start bit (generally due to noise or baud rate mismatch). 0 = a character is not being received 1 = a character is being received if enabled with rie = 1, raf set generates an interrupt when vddpll is high while in wait mode. sc0sr2/sc1sr2 ? sci status register 2 $00c5/$00cd bit 7654321bit 0 0 000000raf reset: 00000000 sc0drh/sc1drh ? sci data register high $00c6/$00ce bit 7654321bit 0 r8t8000000 reset: ???????? sc0drl/sc1drl ? sci data register low $00c7/$00cf bit 7654321bit 0 r7/t7 r6/t6 r5/t5 r4/t4 r3/t3 r2/t2 r1/t1 r0/t0 reset: ???????? 12-msi
multiple serial interface serial peripheral interface (spi) mc68hc912dt128a rev 2.0 motorola multiple serial interface 235 13-msi r8 ? receive bit 8 read anytime. write has no meaning or affect. this bit is the ninth serial data bit received when the sci system is configured for nine-data-bit operation. t8 ? transmit bit 8 read or write anytime. this bit is the ninth serial data bit transmitted when the sci system is configured for nine-data-bit operation. when using 9-bit data format this bit does not have to be written for each data word. the same value will be transmitted as the ninth bit until this bit is rewritten. r7/t7 ? r0/t0 ? receive/transmit data bits 7 to 0 reads access the eight bits of the read-only sci receive data register (rdr). writes access the eight bits of the write-only sci transmit data register (tdr). scxdrl:scxdrh form the 9-bit data word for the sci. if the sci is being used with a 7- or 8-bit data word, only scxdrl needs to be accessed. if a 9-bit format is used, the upper register should be written first to ensure that it is transferred to the transmitter shift register with the lower register. serial peripheral interface (spi) the serial peripheral interface allows the mc68hc912dt128a to communicate synchronously with peripheral devices and other microprocessors. the spi system in the mc68hc912dt128a can operate as a master or as a slave. the spi is also capable of interprocessor communications in a multiple master system. when the spi is enabled, all pins that are defined by the configuration as inputs will be inputs regardless of the state of the ddrs bits for those pins. all pins that are defined as spi outputs will be outputs only if the ddrs bits for those pins are set. any spi output whose corresponding ddrs bit is cleared can be used as a general-purpose input. a bidirectional serial pin is possible using the ddrs as the direction control.
multiple serial interface mc68hc912dt128a rev 2.0 236 multiple serial interface motorola spi baud rate generation the e clock is input to a divider series and the resulting spi clock rate may be selected to be e divided by 2, 4, 8, 16, 32, 64, 128 or 256. three bits in the sp0br register control the spi clock rate. this baud rate generator is activated only when spi is in the master mode and serial transfer is taking place. otherwise this divider is disabled to save power. spi operation in the spi system the 8-bit data register in the master and the 8-bit data register in the slave are linked to form a distributed 16-bit register. when a data transfer operation is performed, this 16-bit register is serially shifted eight bit positions by the sck clock from the master so the data is effectively exchanged between the master and the slave. data written to the sp0dr register of the master becomes the output data for the slave and data read from the sp0dr register of the master after a transfer operation is the input data from the slave. 14-msi
multiple serial interface serial peripheral interface (spi) mc68hc912dt128a rev 2.0 motorola multiple serial interface 237 15-msi figure 33 serial peripheral interface block diagram a clock phase control bit (cpha) and a clock polarity control bit (cpol) in the sp0cr1 register select one of four possible clock formats to be used by the spi system. the cpol bit simply selects non-inverted or inverted clock. the cpha bit is used to accommodate two fundamentally different protocols by shifting the clock by one half cycle or no phase shift. pin control logic 8-bit shift register read data buffer shift control logic clock logic spi control sp0sr spi status register sp0dr spi data register spif wcol modf divider select sp0br spi baud rate register 2 4 8 16 32 64 128 256 spi interrupt internal bus mcu p clock (same as e rate) s m m s m s spr2 spr1 spr0 request spie spe mstr cpol cpha lsbf lsbf pups rds swom spc0 ssoe spe clock mstr swom miso ps4 sck ps6 ss ps7 mosi ps5 hc12 spi block sp0cr1 spi control register 1 sp0cr2 spi control register 2
multiple serial interface mc68hc912dt128a rev 2.0 238 multiple serial interface motorola figure 34 spi clock format 0 (cpha = 0) t l begin end sck (cpol=0) sample i change o sel ss (o) transfer sck (cpol=1) msb first (lsbf=0): lsb first (lsbf=1): msb lsb lsb msb bit 5 bit 2 bit 6 bit 1 bit 4 bit 3 bit 3 bit 4 bit 2 bit 5 bit 1 bit 6 change o sel ss (i) (mosi pin) (miso pin) (master only) (mosi/miso) t t if next transfer begins here for t t , t l , t l minimum 1/2 sck t i t l hc12 spi clock form 0 16-msi
multiple serial interface serial peripheral interface (spi) mc68hc912dt128a rev 2.0 motorola multiple serial interface 239 17-msi figure 35 spi clock format 1 (cpha = 1) ss output available in master mode only, ss output is enabled with the ssoe bit in the sp0cr1 register if the corresponding ddrs is set. the ss output pin will be connected to the ss input pin of the external slave device. the ss output automatically goes low for each transmission to select the external device and it goes high during each idling state to deselect external devices. t l t t for t t , t l , t l minimum 1/2 sck t i t l if next transfer begins here begin end sck (cpol=0) sample i change o sel ss (o) transfer sck (cpol=1) msb first (lsbf=0): lsb first (lsbf=1): msb lsb lsb msb bit 5 bit 2 bit 6 bit 1 bit 4 bit 3 bit 3 bit 4 bit 2 bit 5 bit 1 bit 6 change o sel ss (i) (mosi pin) (miso pin) (master only) (mosi/miso) hc12 spi clock form 1 table 35 ss output selection ddrs7 ssoe master mode slave mode 00ss input with modf feature ss input 01 reserved ss input 1 0 general-purpose output ss input 11 ss output ss input
multiple serial interface mc68hc912dt128a rev 2.0 240 multiple serial interface motorola bidirectional mode (momi or siso) in bidirectional mode, the spi uses only one serial data pin for external device interface. the mstr bit decides which pin to be used. the mosi pin becomes serial data i/o (momi) pin for the master mode, and the miso pin becomes serial data i/o (siso) pin for the slave mode. the direction of each serial i/o pin depends on the corresponding ddrs bit. register descriptions control and data registers for the spi subsystem are described below. the memory address indicated for each register is the default address that is in use after reset. for more information refer to operating modes . read or write anytime. spie ? spi interrupt enable 0 = spi interrupts are inhibited 1 = hardware interrupt sequence is requested each time the spif or modf status flag is set figure 36 normal mode and bidirectional mode when spe=1 master mode mstr=1 slave mode mstr=0 normal mode spc0=0 swom enables open drain output. swom enables open drain output. bidirectional mode spc0=1 swom enables open drain output. ps4 becomes gpio. swom enables open drain output. ps5 becomes gpio. spi mo mi ddrs5 serial out serial in spi si so serial in serial out ddrs4 spi momi ps4 ddrs5 serial out serial in spi ps5 siso ddrs4 serial in serial out sp0cr1 ? spi control register 1 $00d0 bit 7654321bit 0 spie spe swom mstr cpol cpha ssoe lsbf reset: 0 0000100 18-msi
multiple serial interface serial peripheral interface (spi) mc68hc912dt128a rev 2.0 motorola multiple serial interface 241 19-msi spe ? spi system enable 0 = spi internal hardware is initialized and spi system is in a low-power disabled state. 1 = ps[4:7] are dedicated to the spi function when modf is set, spe always reads zero. sp0cr1 must be written as part of a mode fault recovery sequence. swom ? port s wired-or mode controls not only spi output pins but also the general-purpose output pins (ps[4:7]) which are not used by spi. 0 = spi and/or ps[4:7] output buffers operate normally 1 = spi and/or ps[4:7] output buffers behave as open-drain outputs mstr ? spi master/slave mode select 0 = slave mode 1 = master mode when modf is set, mstr always reads zero. sp0cr1 must be written as part of a mode fault recovery sequence. cpol, cpha ? spi clock polarity, clock phase these two bits are used to specify the clock format to be used in spi operations. when the clock polarity bit is cleared and data is not being transferred, the sck pin of the master device is low. when cpol is set, sck idles high. see figure 34 and figure 35 . ssoe ? slave select output enable the ss output feature is enabled only in the master mode by asserting the ssoe and ddrs7. lsbf ? spi lsb first enable 0 = data is transferred most significant bit first 1 = data is transferred least significant bit first normally data is transferred most significant bit first.this bit does not affect the position of the msb and lsb in the data register. reads and writes of the data register will always have msb in bit 7.
multiple serial interface mc68hc912dt128a rev 2.0 242 multiple serial interface motorola read or write anytime. pups ? pull-up port s enable 0 = no internal pull-ups on port s 1 = all port s input pins have an active pull-up device. if a pin is programmed as output, the pull-up device becomes inactive rdps ? reduce drive of port s 0 = port s output drivers operate normally 1 = all port s output pins have reduced drive capability for lower power and less noise sswai ? serial interface stop in wait mode 0 = serial interface clock operates normally 1 = halt serial interface clock generation in wait mode spc0 ? serial pin control 0 this bit decides serial pin configurations with mstr control bit. sp0cr2 ? spi control register 2 $00d1 bit 7654321bit 0 0 0 0 0 pups rdps sswai spc0 reset: 0 0001000 pin mode spc0 (1) 1. the serial pin control 0 bit enables bidirectional configurations. mstr miso (2) 2. slave output is enabled if ddrs4 = 1, ss = 0 and mstr = 0. (#1, #3) mosi (3) 3. master output is enabled if ddrs5 = 1 and mstr = 1. (#2, #4) sck (4) 4. sck output is enabled if ddrs6 = 1 and mstr = 1. (#2, #4) ss (5) 5. ss output is enabled if ddrs7 = 1, ssoe = 1 and mstr = 1. (#2, #4) #1 normal 0 0 slave out slave in sck in ss in #2 1 master in master out sck out ss i/o #3 bidirectional 1 0 slave i/o gpi/o sck in ss in #4 1 gpi/o master i/o sck out ss i/o 20-msi
multiple serial interface serial peripheral interface (spi) mc68hc912dt128a rev 2.0 motorola multiple serial interface 243 21-msi read anytime. write anytime. at reset, e clock divided by 2 is selected. spr[2:0] ? spi clock (sck) rate select bits these bits are used to specify the spi clock rate. read anytime. write has no meaning or effect. spif ? spi interrupt request spif is set after the eighth sck cycle in a data transfer and it is cleared by reading the sp0sr register (with spif set) followed by an access (read or write) to the spi data register. sp0br ? spi baud rate register $00d2 bit 7654321bit 0 00000spr2spr1spr0 reset: 0 0000000 table 36 spi clock rate selection spr2 spr1 spr0 e clock divisor frequency at e clock = 4 mhz frequency at e clock = 8 mhz 0 0 0 2 2.0 mhz 4.0 mhz 0 0 1 4 1.0 mhz 2.0 mhz 0 1 0 8 500 khz 1.0 mhz 0 1 1 16 250 khz 500 khz 1 0 0 32 125 khz 250 khz 1 0 1 64 62.5 khz 125 khz 1 1 0 128 31.3 khz 62.5 khz 1 1 1 256 15.6 khz 31.3 khz sp0sr ? spi status register $00d3 bit 7654321bit 0 spifwcol0modf0000 reset: 00000000
multiple serial interface mc68hc912dt128a rev 2.0 244 multiple serial interface motorola wcol ? write collision status flag the mcu write is disabled to avoid writing over the data being transferred. no interrupt is generated because the error status flag can be read upon completion of the transfer that was in progress at the time of the error. automatically cleared by a read of the sp0sr (with wcol set) followed by an access (read or write) to the sp0dr register. 0 = no write collision 1 = indicates that a serial transfer was in progress when the mcu tried to write new data into the sp0dr data register. modf ? spi mode error interrupt status flag this bit is set automatically by spi hardware if the mstr control bit is set and the slave select input pin becomes zero. this condition is not permitted in normal operation. in the case where ddrs bit 7 is set, the ps7 pin is a general-purpose output pin or ss output pin rather than being dedicated as the ss input for the spi system. in this special case the mode fault function is inhibited and modf remains cleared. this flag is automatically cleared by a read of the sp0sr (with modf set) followed by a write to the sp0cr1 register. read anytime (normally only after spif flag set). write anytime (see wcol write collision flag). reset does not affect this address. this 8-bit register is both the input and output register for spi data. reads of this register are double buffered but writes cause data to written directly into the serial shifter. in the spi system the 8-bit data register in the master and the 8-bit data register in the slave are linked by the mosi and miso wires to form a distributed 16-bit register. when a data transfer operation is performed, this 16-bit register is serially shifted eight bit positions by the sck clock from the master so the data is effectively exchanged between the master and the slave. note that sp0dr ? spi data register $00d5 bit 7654321bit 0 bit 7654321bit 0 22-msi
multiple serial interface port s mc68hc912dt128a rev 2.0 motorola multiple serial interface 245 23-msi some slave devices are very simple and either accept data from the master without returning data to the master or pass data to the master without requiring data from the master. port s in all modes, port s bits ps[7:0] can be used for either general-purpose i/o, or with the sci and spi subsystems. during reset, port s pins are configured as high-impedance inputs (ddrs is cleared). read anytime (inputs return pin level; outputs return pin driver input level). write data stored in internal latch (drives pins only if configured for output). writes do not change pin state when pin configured for spi or sci output. after reset all bits are configured as general-purpose inputs. port s shares function with the on-chip serial systems (spi and sci0/1). read or write anytime. after reset, all general-purpose i/o are configured for input only. 0 = configure the corresponding i/o pin for input only 1 = configure the corresponding i/o pin for output ports ? port s data register $00d6 bit 7654321bit 0 ps7 ps6 ps5 ps4 ps3 ps2 ps1 ps0 msi ss cs sck mosi momi miso siso txd1 rxd1 txd0 rxd0 reset: - - ------ ddrs ? data direction register for port s $00d7 bit 7654321bit 0 dds7 dds6 dds5 dds4 dds3 dds2 dds1 dds0 reset: 0 0000000
multiple serial interface mc68hc912dt128a rev 2.0 246 multiple serial interface motorola dds2, dds0 ? data direction for port s bit 2 and bit 0 if the sci receiver is configured for two-wire sci operation, corresponding port s pins will be input regardless of the state of these bits. dds3, dds1 ? data direction for port s bit 3 and bit 1 if the sci transmitter is configured for two-wire sci operation, corresponding port s pins will be output regardless of the state of these bits. dds[6:4] ? data direction for port s bits 6 through 4 if the spi is enabled and expects the corresponding port s pin to be an input, it will be an input regardless of the state of the ddrs bit. if the spi is enabled and expects the bit to be an output, it will be an output only if the ddrs bit is set. dds7 ? data direction for port s bit 7 in spi slave mode, ddrs7 has no meaning or effect; the ps7 pin is dedicated as the ss input. in spi master mode, ddrs7 determines whether ps7 is an error detect input to the spi or a general-purpose or slave select output line. note: if mode fault error occurs bits 5, 6 and 7 are forced to zero. 24-msi
mc68hc912dt128a rev 2.0 motorola inter-ic bus 247 inter-ic bus inter-ic bus contents introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247 iic features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248 iic system configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250 iic protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250 iic register descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254 iic programming examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263 introduction the inter-ic bus (iic or i 2 c) is a two-wire, bidirectional serial bus that provides a simple, efficient method of data exchange between devices. being a two-wire device, the iic minimizes the need for large numbers of connections between devices, and eliminates the need for an address decoder. this bus is suitable for applications requiring occasional communications over a short distance between a number of devices. it also provides flexibility, allowing additional devices to be connected to the bus for further expansion and system development. the interface is designed to operate up to 100kbps with maximum bus loading and timing. the device is capable of operating at higher baud rates, up to a maximum of clock/20, with reduced bus loading. the maximum communication length and the number of devices that can be connected are limited by a maximum bus capacitance of 400pf. 1-iicbus
inter-ic bus mc68hc912dt128a rev 2.0 248 inter-ic bus motorola iic features the iic module has the following key features:  compatible with i 2 c bus standard  multi-master operation  software programmable for one of 64 different serial clock frequencies  software selectable acknowledge bit  interrupt driven byte-by-byte data transfer  arbitration lost interrupt with automatic mode switching from master to slave  calling address identification interrupt  start and stop signal generation/detection  repeated start signal generation  acknowledge bit generation/detection  bus busy detection  eight-bit general purpose i/o port a block diagram of the iic module is shown in figure 37 . 2--iicbus
inter-ic bus iic features mc68hc912dt128a rev 2.0 motorola inter-ic bus 249 figure 37 iic block diagram input sync in/out data shift register address compare scl sda interrupt addr & control data clock control start, stop & arbitration control ctrl_reg freq_reg addr_reg status_reg data_reg addr_decode data_mux 3-iicbus
inter-ic bus mc68hc912dt128a rev 2.0 250 inter-ic bus motorola iic system configuration the iic system uses a serial data line (sda) and a serial clock line (scl) for data transfer. all devices connected to it must have open drain or open collector outputs. logic ? and ? function is exercised on both lines with external pull-up resistors, the value of these resistors is system dependent. iic protocol normally, a standard communication is composed of four parts: start signal, slave address transmission, data transfer and stop signal. they are described briefly in the following sections and illustrated in figure 38 . figure 38 iic transmission signals scl sda start signal ack bit 1 2 34 5 6 78 msb lsb 1 2 34 5 6 78 msb lsb stop signal no scl sda 1234567 8 msb lsb 1 2 5 678 msb lsb repeated 34 9 9 ad7 ad6 ad5 ad4 ad3 ad2 ad1 r/w xxx d7 d6 d5 d4 d3 d2 d1 d0 calling address read/ data byte ad7 ad6 ad5 ad4 ad3 ad2 ad1 r/w ad7 ad6 ad5 ad4 ad3 ad2 ad1 r/w new calling address 99 xx ack bit write start signal start signal ack bit calling address read/ write stop signal no ack bit read/ write 4-iicbus
inter-ic bus iic protocol mc68hc912dt128a rev 2.0 motorola inter-ic bus 251 start signal when the bus is free, i.e. no master device is engaging the bus (both scl and sda lines are at logical high), a master may initiate communication by sending a start signal. as shown in figure 38 , a start signal is defined as a high-to-low transition of sda while scl is high. this signal denotes the beginning of a new data transfer (each data transfer may contain several bytes of data) and wakes up all slaves. slave address transmission the first byte of data transfer immediately after the start signal is the slave address transmitted by the master. this is a seven-bit calling address followed by a r/w bit. the r/w bit tells the slave the desired direction of data transfer. 1 = read transfer, the slave transmits data to the master. 0 = write transfer, the master transmits data to the slave. only the slave with a calling address that matches the one transmitted by the master will respond by sending back an acknowledge bit. this is done by pulling the sda low at the 9th clock (see figure 38 ). slave address - no two slaves in the system may have the same address. if the iic is master, it must not transmit an address that is equal to its own slave address. the iic cannot be master and slave at the same time. if however arbitration is lost during an address cycle the iic will revert to slave mode and operate correctly even if it is being addressed by another master. data transfer once successful slave addressing is achieved, the data transfer can proceed byte-by-byte in a direction specified by the r/w bit sent by the calling master. note: all transfers that come after an address cycle are referred to as data transfers, even if they carry sub-address information for the slave device. each data byte is 8 bits long. data may be changed only while scl is low and must be held stable while scl is high as shown in figure 38 . there is one clock pulse on scl for each data bit, the msb being transferred first. each data byte has to be followed by an acknowledge 5-iicbus
inter-ic bus mc68hc912dt128a rev 2.0 252 inter-ic bus motorola bit, which is signalled from the receiving device by pulling the sda low at the ninth clock. so one complete data byte transfer needs nine clock pulses. if the slave receiver does not acknowledge the master, the sda line must be left high by the slave. the master can then generate a stop signal to abort the data transfer or a start signal (repeated start) to commence a new calling. if the master receiver does not acknowledge the slave transmitter after a byte transmission, it means ? end of data ? to the slave, so the slave releases the sda line for the master to generate stop or start signal. stop signal the master can terminate the communication by generating a stop signal to free the bus. however, the master may generate a start signal followed by a calling command without generating a stop signal first. this is called repeated start. a stop signal is defined as a low-to-high transition of sda while scl at logical ? 1 ? (see figure 38 ). the master can generate a stop even if the slave has generated an acknowledge at which point the slave must release the bus. repeated start signal as shown in figure 38 , a repeated start signal is a start signal generated without first generating a stop signal to terminate the communication. this is used by the master to communicate with another slave or with the same slave in different mode (transmit/receive mode) without releasing the bus. arbitration procedure iic is a true multi-master bus that allows more than one master to be connected on it. if two or more masters try to control the bus at the same time, a clock synchronization procedure determines the bus clock, for which the low period is equal to the longest clock low period and the high is equal to the shortest one among the masters. the relative priority of the contending masters is determined by a data arbitration procedure, a bus master loses arbitration if it transmits logic ? 1 ? while another master transmits logic ? 0 ? . the losing masters immediately switch over to slave receive mode and stop driving sda output. in this case the transition 6-iicbus
inter-ic bus iic protocol mc68hc912dt128a rev 2.0 motorola inter-ic bus 253 7-iicbus from master to slave mode does not generate a stop condition. meanwhile, a status bit is set by hardware to indicate loss of arbitration. clock synchronization since wire-and logic is performed on scl line, a high-to-low transition on scl line affects all the devices connected on the bus. the devices start counting their low period and once a device ? s clock has gone low, it holds the scl line low until the clock high state is reached. however, the change of low to high in this device clock may not change the state of the scl line if another device clock is still within its low period. therefore, synchronized clock scl is held low by the device with the longest low period. devices with shorter low periods enter a high wait state during this time (see figure 39 ). when all devices concerned have counted off their low period, the synchronized clock scl line is released and pulled high. there is then no difference between the device clocks and the state of the scl line and all the devices start counting their high periods. the first device to complete its high period pulls the scl line low again. figure 39 iic clock synchronization handshaking the clock synchronization mechanism can be used as a handshake in data transfer. slave devices may hold the scl low after completion of scl1 scl2 scl internal counter reset wait start counting high period
inter-ic bus mc68hc912dt128a rev 2.0 254 inter-ic bus motorola one byte transfer (9 bits). in such case, it halts the bus clock and forces the master clock into wait states until the slave releases the scl line. clock stretching the clock synchronization mechanism can be used by slaves to slow down the bit rate of a transfer. after the master has driven scl low the slave can drive scl low for the required period and then release it. if the slave scl low period is greater than the master scl low period then the resulting scl bus signal low period is stretched. iic register descriptions . read and write anytime this register contains the address the iic will respond to when addressed as a slave; note that it is not the address sent on the bus during the address transfer adr7 ? adr1 ? slave address bit 1 to bit 7 contain the specific slave address to be used by the iic module. the default mode of iic is slave mode for an address match on the bus. read and write anytime ibad ? iic bus address register $00e0 bit 7654321bit 0 adr7 adr6 adr5 adr4 adr3 adr2 adr1 0 reset: 0 0 0 0 0 0 0 0 ibfd ? iic bus frequency divider register $00e1 bit 7654321bit 0 00 ibc5 ibc4 ibc3 ibc2 ibc1 ibc0 reset: 0 0000000 8-iicbus
inter-ic bus iic register descriptions mc68hc912dt128a rev 2.0 motorola inter-ic bus 255 9-iicbus ibc5 ? ibc0 ? iic bus clock rate 5 ? 0 this field is used to prescale the clock for bit rate selection. the bit clock generator is implemented as a prescaled shift register - ibc5-3 select the prescaler divider and ibc2-0 select the shift register tap point. the ibc bits are decoded to give the tap and prescale values as shown in table 37 . note: at 8 mhz system bus frequency, the iic bus frequency will slow down by as much as 5%. however, the communications rate of the iic system will be automatically adjusted to a slower rate. the number of clocks from the falling edge of scl to the first tap (tap[1]) is defined by the values shown in the scl2tap column of table 37 , all subsequent tap points are separated by 2 ibc5-3 as shown in the tap2tap column in table 37 . the scl tap is used to generated the scl period and the sda tap is used to determine the delay from the falling edge of scl to sda changing, the sda hold time. the serial bit clock frequency is equal to the cpu clock frequency divided by the divider shown in table 3 . the equation used to generate the divider values from the ibfd bits is: scl divider = 2 x ( scl2tap + [ ( scl_tap -1 ) x tap2tap ] + 2 ) table 37 iic tap and prescale values ibc2-0 (bin) scl tap (clocks) sda tap (clocks) ibc5-3 (bin) scl2tap (clocks) tap2tap (clocks) 000 5 1 000 4 1 001 6 1 001 4 2 010 7 2 010 6 4 011 8 2 011 6 8 100 9 3 100 14 16 101 10 3 101 30 32 110 12 4 110 62 64 111 15 4 111 126 128
inter-ic bus mc68hc912dt128a rev 2.0 256 inter-ic bus motorola the sda hold delay is equal to the cpu clock period multiplied by the sda hold value shown in figure 3 . the equation used to generate the sda hold value from the ibfd bits is: sda hold = scl2tap + [ ( sda_tap - 1 ) x tap2tap ] + 3 table 3 iic divider and sda hold values ibc5-0 (hex) scl divider (clocks) sda hold (clocks) ibc5-0 (hex) scl divider (clocks) sda hold (clocks) 00 20 7 20 160 17 01 22 7 21 192 17 02 24 8 22 224 33 03 26 8 23 256 33 04 28 9 24 288 49 05 30 9 25 320 49 06 34 10 26 384 65 07 40 10 27 480 65 08 28 7 28 320 33 09 32 7 29 384 33 0a 36 9 2a 448 65 0b 40 9 2b 512 65 0c 44 11 2c 576 97 0d 48 11 2d 640 97 0e 56 13 2e 768 129 0f 68 13 2f 960 129 10 48 9 30 640 65 11 56 9 31 768 65 12 64 13 32 896 129 13 72 13 33 1024 129 14 80 17 34 1152 193 15 88 17 35 1280 193 16 104 21 36 1536 257 10-iicbus
inter-ic bus iic register descriptions mc68hc912dt128a rev 2.0 motorola inter-ic bus 257 11-iicbus read and write anytime iben ? iic bus enable this bit controls the software reset of the entire iic module. 0 = the module is reset and disabled. this is the power-on reset situation. when low the iic system is held in reset but registers can still be accessed. 1 = the iic system is enabled. this bit must be set before any other ibcr bits have any effect. if the iic module is enabled in the middle of a byte transfer the interface behaves as follows: slave mode ignores the current transfer on the bus and starts operating whenever a subsequent start condition is detected. master mode will not be aware that the bus is busy, hence if a start cycle is initiated then the current bus cycle may become corrupt. this would ultimately result in either the current bus master or the iic module losing arbitration, after which bus operation would return to normal. 17 128 21 37 1920 257 18 80 9 38 1280 129 19 96 9 39 1536 129 1a 112 17 3a 1792 257 1b 128 17 3b 2048 257 1c 144 25 3c 2304 385 1d 160 25 3d 2560 385 1e 192 33 3e 3072 513 1f 240 33 3f 3840 513 table 3 iic divider and sda hold values ibc5-0 (hex) scl divider (clocks) sda hold (clocks) ibc5-0 (hex) scl divider (clocks) sda hold (clocks) ibcr ? iic bus control register $00e2 bit 7654321bit 0 iben ibie ms/sl tx/rx txak rsta 0 ibswai reset: 00000000
inter-ic bus mc68hc912dt128a rev 2.0 258 inter-ic bus motorola note: to prevent glitches from appearing on the sda & scl lines during reset of the iic module, set portib bit 6 & 7 to 1 before clearing the iben bit. ibie ? iic bus interrupt enable 0 = interrupts from the iic module are disabled. note that this does not clear any currently pending interrupt condition. 1 = interrupts from the iic module are enabled. an iic interrupt occurs provided the ibif bit in the status register is also set. ms/sl ? master/slave mode select bit upon reset, this bit is cleared. when this bit is changed from 0 to 1, a start signal is generated on the bus, and the master mode is selected. when this bit is changed from 1 to 0, a stop signal is generated and the operation mode changes from master to slave. ms/sl is cleared without generating a stop signal when the master loses arbitration. 0 = slave mode 1 = master mode tx/rx ? transmit/receive mode select bit this bit selects the direction of master and slave transfers. when addressed as a slave this bit should be set by software according to the srw bit in the status register. in master mode this bit should be set according to the type of transfer required. therefore, for address cycles, this bit will always be high. 0 = receive 1 = transmit txak ? transmit acknowledge enable this bit specifies the value driven onto sda during acknowledge cycles for both master and slave receivers. note that values written to this bit are only used when the iic is a receiver, not a transmitter. 0 = an acknowledge signal will be sent out to the bus at the 9th clock bit after receiving one byte data 1 = no acknowledge signal response is sent (i.e., acknowledge bit = 1) 12-iicbus
inter-ic bus iic register descriptions mc68hc912dt128a rev 2.0 motorola inter-ic bus 259 13-iicbus rsta ? repeat start writing a 1 to this bit will generate a repeated start condition on the bus, provided it is the current bus master. this bit will always be read as a low. attempting a repeated start at the wrong time, if the bus is owned by another master, will result in loss of arbitration. 1 = generate repeat start cycle ibswai ? iic stop in wait mode 0 = iic module operates normally 1 = halt clock generation of iic module in wait mode this status register is read-only with exception of bit 1 (ibif) and bit 4 (ibal), which are software clearable tcf ? data transferring bit while one byte of data is being transferred, this bit is cleared. it is set by the falling edge of the 9th clock of a byte transfer. 0 = transfer in progress 1 = transfer complete iaas ? addressed as a slave bit when its own specific address (iic bus address register) is matched with the calling address, this bit is set. the cpu is interrupted provided the ibie is set. then the cpu needs to check the srw bit and set its tx/rx mode accordingly. writing to the iic bus control register clears this bit. 0 = not addressed 1 = addressed as a slave ibb ? iic bus busy bit this bit indicates the status of the bus. when a start signal is detected, the ibb is set. if a stop signal is detected, it is cleared. 0 = bus is idle 1 = bus is busy ibsr ? iic bus status register $00e3 bit 7654321bit 0 tcf iaas ibb ibal 0 srw ibif rxak reset:10000000
inter-ic bus mc68hc912dt128a rev 2.0 260 inter-ic bus motorola note: if, after trying to generate a start signal and neither the ibb nor ibal bits are set after several cycles, the iic should be disabled and re-enabled with iben bit. ibal ? arbitration lost the arbitration lost bit (ibal) is set by hardware when the arbitration procedure is lost. arbitration is lost in the following circumstances: 1. sda sampled as low when the master drives a high during an address or data transmit cycle. 2. sda sampled as a low when the master drives a high during the acknowledge bit of a data receive cycle. 3. a start cycle is attempted when the bus is busy. 4. a repeated start cycle is requested in slave mode. 5. a stop condition is detected when the master did not request it. this bit must be cleared by software, by writing a one to it. note: if, after trying to generate a start signal and neither the ibb nor ibal bits are set after several cycles, the iic should be disabled and re-enabled with iben bit. srw ? slave read/write when iaas is set this bit indicates the value of the r/w command bit of the calling address sent from the master. caution: this bit is only valid when the iic is in slave mode, a complete address transfer has occurred with an address match and no other transfers have been initiated. checking this bit, the cpu can select slave transmit/receive mode according to the command of the master. 0 = slave receive, master writing to slave 1 = slave transmit, master reading from slave ibif ? iic bus interrupt flag the ibif bit is set when an interrupt is pending, which will cause a processor interrupt request provided ibie is set. ibif is set when one of the following events occurs: 14-iicbus
inter-ic bus iic register descriptions mc68hc912dt128a rev 2.0 motorola inter-ic bus 261 15-iicbus 1. complete one byte transfer (set at the falling edge of the 9th clock). 2. receive a calling address that matches its own specific address in slave receive mode. 3. arbitration lost. this bit must be cleared by software, writing a one to it, in the interrupt routine. rxak ? received acknowledge the value of sda during the acknowledge bit of a bus cycle. if the received acknowledge bit (rxak) is low, it indicates an acknowledge signal has been received after the completion of 8 bits data transmission on the bus. if rxak is high, it means no acknowledge signal is detected at the 9th clock. 0 = acknowledge received 1 = no acknowledge received . read and write anytime in master transmit mode, when data is written to the ibdr a data transfer is initiated. the most significant bit is sent first. in master receive mode, reading this register initiates next byte data receiving. in slave mode, the same functions are available after an address match has occurred. note: in master transmit mode, the first byte of data written to ibdr following assertion of ms/sl is used for the address transfer and should comprise of the calling address (in position d7-d1) concatenated with the required r/w bit (in position d0). ibdr ? iic bus data i/o register $00e4 bit 7654321bit 0 d7 d6 d5 d4 d3 d2 d1 d0 high reset: 0 0000000
inter-ic bus mc68hc912dt128a rev 2.0 262 inter-ic bus motorola read and write anytime rdpib - reduced drive of port ib 0 = all port ib output pins have full drive enabled. 1 = all port ib output pins have reduced drive capability. pupib - pull-up port ib enable 0 = port ib pull-ups are disabled. 1 = enable pull-up devices for port ib input pins [7:6]. pull-ups for port ib input pins [5:0] are always enabled. read and write anytime. iic functions scl and sda share port ib pins 7 and 6 and take precedence over the general-purpose port when iic is enabled. the scl and sda output buffers behave as open-drain outputs. when port is configured as input, a read will return the pin level. port bits 5 through 0 have internal pull ups when configured as inputs so they will read ones. when configured as output, a read will return the latched output data. port bits 5 through 0 will read the last value written. a write will drive associated pins only if configured for output and iic is not enabled. port bits 5 through 0 do not have available external pins for mc68hc912dt128a. ibpurd ? pull-up and reduced drive for port ib $00e5 bit 7654321bit 0 000rdpib000pupib reset: 0 0 000000 portib ? port data ib register $00e6 bit 7654321bit 0 pib7 pib6 pib5 pib4 pib3 pib2 pib1 pib0 iicsclsda------ reset: -------- 16-iicbus
inter-ic bus iic programming examples mc68hc912dt128a rev 2.0 motorola inter-ic bus 263 17-iicbus read and write anytime ddrib[7:2] ? port ib [7:2] data direction each bit determines the primary direction for each pin configured as general-purpose i/o. 0 = associated pin is a high-impedance input. 1 = associated pin is an output. ddrib[5:0] ? these bits served as memory locations since there are no corresponding external port pins for mc68hc912dt128a. iic programming examples initialization sequence reset will put the iic bus control register to its default status. before the interface can be used to transfer serial data, an initialization procedure must be carried out, as follows: 1. update the frequency divider register (ibfd) and select the required division ratio to obtain scl frequency from system clock. 2. update the iic bus address register (ibad) to define its slave address. 3. set the iben bit of the iic bus control register (ibcr) to enable the iic interface system. 4. modify the bits of the iic bus control register (ibcr) to select master/slave mode, transmit/receive mode and interrupt enable or not. generation of start after completion of the initialization procedure, serial data can be transmitted by selecting the 'master transmitter' mode. if the device is ddrib ? data direction for port ib register $00e7 bit 7654321bit 0 ddrib7 ddrib6 ddrib5 ddrib4 ddrib3 ddrib2 ddrib1 ddrib0 reset: 0 0 0 00000
inter-ic bus mc68hc912dt128a rev 2.0 264 inter-ic bus motorola connected to a multi-master bus system, the state of the iic bus busy bit (ibb) must be tested to check whether the serial bus is free. if the bus is free (ibb=0), the start condition and the first byte (the slave address) can be sent. the data written to the data register comprises the slave calling address and the lsb set to indicate the direction of transfer required from the slave. the bus free time (i.e., the time between a stop condition and the following start condition) is built into the hardware that generates the start cycle. depending on the relative frequencies of the system clock and the scl period it may be necessary to wait until the iic is busy after writing the calling address to the ibdr before proceeding with the following instructions. this is illustrated in the following example. an example of a program which generates the start signal and transmits the first byte of data (slave address) is shown below: post-transfer software response transmission or reception of a byte will set the data transferring bit (tcf) to 1, which indicates one byte communication is finished. the iic bus interrupt bit (ibif) is set also; an interrupt will be generated if the interrupt function is enabled during initialization by setting the ibie bit. software must clear the ibif bit in the interrupt routine first. the tcf bit will be cleared by reading from the iic bus data i/o register (ibdr) in receive mode or writing to ibdr in transmit mode. software may service the iic i/o in the main program by monitoring the ibif bit if the interrupt function is disabled. note that polling should monitor the ibif bit rather than the tcf bit since their operation is different when arbitration is lost. note that when an interrupt occurs at the end of the address cycle the master will always be in transmit mode, i.e. the address is transmitted. if chflag brset ibsr,#$20,* ;wait for ibb flag to clear txstart bset ibcr,#$30 ;set transmit and master mode ;i.e. generate start condition movb calling,ibdr ;transmit the calling ;address, d0=r/w ibfree brclr ibsr,#$20,* ;wait for ibb flag to set 18-iicbus
inter-ic bus iic programming examples mc68hc912dt128a rev 2.0 motorola inter-ic bus 265 19-iicbus master receive mode is required, indicated by r/w bit in ibdr, then the tx/rx bit should be toggled at this stage. during slave mode address cycles (iaas=1) the srw bit in the status register is read to determine the direction of the subsequent transfer and the tx/rx bit is programmed accordingly. for slave mode data cycles (iaas=0) the srw bit is not valid, the tx/rx bit in the control register should be read to determine the direction of the current transfer. the following is an example of a software response by a ? master transmitter ? in the interrupt routine (see figure 40 ). generation of stop a data transfer ends with a stop signal generated by the ? master ? device. a master transmitter can simply generate a stop signal after all the data has been transmitted. the following is an example showing how a stop condition is generated by a master transmitter. if a master receiver wants to terminate a data transfer, it must inform the slave transmitter by not acknowledging the last byte of data which can be done by setting the transmit acknowledge bit (txak) before reading the 2nd last byte of data. before reading the last byte of data, a stop isr bclr ibsr,#$02 ;clear the ibif flag brclr ibcr,#$20,slave ;branch if in slave mode brclr ibcr,#$10,receive ;branch if in receive mode brset ibsr,#$01,end ;if no ack, end of transmission transmit movb databuf,ibdr ;transmit next byte of data mastx tst txcnt ;get value from the ;transmiting counter beq end ;end if no more data brset ibsr,#$01,end ;end if no ack movb databuf,ibdr ;transmit next byte of data dec txcnt ;decrease the txcnt bra emastx ;exit end bclr ibcr,#$20 ;generate a stop condition emastx rti ;return from interrupt
inter-ic bus mc68hc912dt128a rev 2.0 266 inter-ic bus motorola signal must be generated first. the following is an example showing how a stop signal is generated by a master receiver. generation of repeated start at the end of data transfer, if the master still wants to communicate on the bus, it can generate another start signal followed by another slave address without first generating a stop signal. a program example is as shown. slave mode in the slave interrupt service routine, the module addressed as slave bit (iaas) should be tested to check if a calling of its own address has just been received (see figure 40 ). if iaas is set, software should set the transmit/receive mode select bit (tx/rx bit of ibcr) according to the r/ w command bit (srw). writing to the ibcr clears the iaas automatically. note that the only time iaas is read as set is from the interrupt at the end of the address cycle where an address match occurred, interrupts resulting from subsequent data transfers will have iaas cleared. a data transfer may now be initiated by writing information to ibdr, for slave transmits, or dummy reading from ibdr, in slave receive mode. the slave will drive scl low in-between byte transfers, scl is released when the ibdr is accessed in the required mode. in slave transmitter routine, the received acknowledge bit (rxak) must be tested before transmitting the next byte of data. setting rxak means masr dec rxcnt ;decrease the rxcnt beq enmasr ;last byte to be read movb rxcnt,d1 ;check second last byte dec d1 ;to be read bne nxmar ;not last or second last lamar bset ibcr,#$08 ;second last, disable ack ;transmitting bra nxmar enmasr bclr ibcr,#$20 ;last one, generate ?stop? signal nxmar movb ibdr,rxbuf ;read data and store rti restart bset ibcr,#$04 another start (restart) movb calling,ibdr ;transmit the calling address ;d0=r/w 20-iicbus
inter-ic bus iic programming examples mc68hc912dt128a rev 2.0 motorola inter-ic bus 267 21-iicbus an ? end of data ? signal from the master receiver, after which it must be switched from transmitter mode to receiver mode by software. a dummy read then releases the scl line so that the master can generate a stop signal. arbitration lost if several masters try to engage the bus simultaneously, only one master wins and the others lose arbitration. the devices which lost arbitration are immediately switched to slave receive mode by the hardware. their data output to the sda line is stopped, but scl is still generated until the end of the byte during which arbitration was lost. an interrupt occurs at the falling edge of the ninth clock of this transfer with ibal=1 and ms/ sl =0. if one master attempts to start transmission while the bus is being engaged by another master, the hardware will inhibit the transmission; switch the ms/sl bit from 1 to 0 without generating stop condition; generate an interrupt to cpu and set the ibal to indicate that the attempt to engage the bus is failed. when considering these cases, the slave service routine should test the ibal first and the software should clear the ibal bit if it is set.
inter-ic bus mc68hc912dt128a rev 2.0 268 inter-ic bus motorola figure 40 flow-chart of typical iic interrupt routine clear master mode ? tx/rx ? last byte transmitted ? rxak=0 ? end of addr cycle (master rx) ? write next byte to ibdr switch to rx mode dummy read from ibdr generate stop signal read data from ibdr and store set txak =1 generate stop signal 2nd last byte to be read ? last byte to be read ? arbitration lost ? clear ibal iaas=1 ? iaas=1 ? srw=1 ? tx/rx ? set tx mode write data to ibdr set rx mode dummy read from ibdr ack from receiver ? tx next byte read data from ibdr and store switch to rx mode dummy read from ibdr rti yn y y y y y y y y y n n n n n n n n n y tx rx rx tx (write) (read) n ibif address transfer data transfer 22-iicbus
mc68hc912dt128a rev 2.0 motorola mscan controller 269 mscan controller mscan controller contents introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269 external pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270 message storage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271 identifier acceptance filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276 interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279 protocol violation protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281 low power modes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282 timer link . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285 clock system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286 memory map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288 programmer ? s model of message storage . . . . . . . . . . . . . . . . . . . . 289 programmer ? s model of control registers . . . . . . . . . . . . . . . . . . . . 294 introduction the mc68hc912dt128a has three identical mscan12 modules, identified as can0, can1 and can2. the mc68hc912dg128a has two: can0 and can1. the information to follow describes one mscan unless specifically noted and register locations specifically relate to can0. can1 registers are located 512 bytes from can0, and on the mc68hc912dt128a, can2 registers are located 256 bytes from can0. the mscan12 is the specific implementation of the motorola scalable can (mscan) concept targeted for the motorola m68hc12 microcontroller family. 1-mscan12
mscan controller mc68hc912dt128a rev 2.0 270 mscan controller motorola the module is a communication controller implementing the can 2.0 a/ b protocol as defined in the bosch specification dated september 1991. the can protocol was primarily, but not only, designed to be used as a vehicle serial data bus, meeting the specific requirements of this field: real-time processing, reliable operation in the emi environment of a vehicle, cost-effectiveness and required bandwidth. mscan12 utilizes an advanced buffer arrangement resulting in a predictable real-time behavior and simplifies the application software. external pins the mscan12 uses 2 external pins, 1 input (rxcan) and 1 output (txcan). the txcan output pin represents the logic level on the can: 0 is for a dominant state, and 1 is for a recessive state. rxcan is on bit 0 of port can, txcan is on bit 1. the remaining six pins of port can are controlled by registers in the mscan12 address space (see mscan12 port can control register (pctlcan) and mscan12 port can data direction register (ddrcan) ). a typical can system with mscan12 is shown in figure 41 below. each can station is connected physically to the can bus lines through a transceiver chip. the transceiver is capable of driving the large current needed for the can and has current protection, against defected can or defected stations. 2--mscan12
mscan controller message storage mc68hc912dt128a rev 2.0 motorola mscan controller 271 figure 41 the can system message storage mscan12 facilitates a sophisticated message storage system which addresses the requirements of a broad range of network applications. background modern application layer software is built upon two fundamental assumptions: 1. any can node is able to send out a stream of scheduled messages without releasing the bus between two messages. such nodes will arbitrate for the bus right after sending the previous message and will only release the bus in case of lost arbitration. 2. the internal message queue within any can node is organized such that if more than one message is ready to be sent, the highest priority message will be sent out first. above behavior can not be achieved with a single transmit buffer. that buffer must be reloaded right after the previous message has been sent. transceiver mscan12 can system can station 1 can station 2 can station n can txcan rxcan ..... controller 3-mscan12
mscan controller mc68hc912dt128a rev 2.0 272 mscan controller motorola this loading process lasts a definite amount of time and has to be completed within the inter-frame sequence (ifs) in order to be able to send an uninterrupted stream of messages. even if this is feasible for limited can bus speeds it requires that the cpu reacts with short latencies to the transmit interrupt. a double buffer scheme would de-couple the re-loading of the transmit buffers from the actual message sending and as such reduces the reactiveness requirements on the cpu. problems may arise if the sending of a message would be finished just while the cpu re-loads the second buffer, no buffer would then be ready for transmission and the bus would be released. at least three transmit buffers are required to meet the first of above requirements under all circumstances. the mscan12 has three transmit buffers. the second requirement calls for some sort of internal prioritizing which the mscan12 implements with the local priority concept described below. receive structures the received messages are stored in a two stage input fifo. the two message buffers are mapped using a ping-pong arrangement into a single memory area (see figure 42 ). while the background receive buffer (rxbg) is exclusively associated to the mscan12, the foreground receive buffer (rxfg) is addressed by the cpu12. this scheme simplifies the handler software as only one address area is applicable for the receive process. both buffers have a size of 13 bytes to store the can control bits, the identifier (standard or extended) and the data contents (for details see programmer ? s model of message storage ). the receiver full flag (rxf) in the mscan12 receiver flag register (crflg) (see mscan12 receiver flag register (crflg) ) signals the status of the foreground receive buffer. when the buffer contains a correctly received message with matching identifier this flag is set. after the mscan12 successfully received a message into the background buffer and if the message passes the filter, it copies the 4-mscan12
mscan controller message storage mc68hc912dt128a rev 2.0 motorola mscan controller 273 content of rxbg into rxfg 1 , sets the rxf flag, and emits a receive interrupt to the cpu 2 . a new message (which may follow immediately after the ifs field of the can frame) will be received into rxbg. the over-writing of the background buffer is independent of the identifier filter function. the user ? s receive handler has to read the received message from rxfg and to reset the rxf flag in order to acknowledge the interrupt and to release the foreground buffer. an overrun condition occurs when both the foreground and the background receive message buffers are filled with correctly received messages with accepted identifiers and a further correctly received message with accepted identifier is received from the bus. the latter message will be discarded and an error interrupt with overrun indication will occur if enabled. as long as both buffers remain filled, the mscan12 is able to transmit messages but it will discard all incoming messages. note: the mscan12 will receive its own messages into the background receive buffer rxbg but will not overwrite rxfg and will not emit a receive interrupt nor will it acknowledge (ack) its own messages on the can bus. the exception to this rule is that when in loop-back mode mscan12 will treat its own messages exactly like all other incoming messages. 1. only if the rxf flag is not set. 2. the receive interrupt will occur only if not masked. a polling scheme can be applied on rxf also. 5-mscan12
mscan controller mc68hc912dt128a rev 2.0 274 mscan controller motorola figure 42 user model for message buffer organization transmit structures the mscan12 has a triple transmit buffer scheme in order to allow multiple messages to be set up in advance and to achieve an optimized real-time performance. the three buffers are arranged as shown in figure 42 . all three buffers have a 13 byte data structure similar to the outline of the receive buffers (see programmer ? s model of message storage ). an additional transmit buffer priority register (tbpr) contains an 8-bit so called local priority field (prio) (see transmit buffer priority registers (tbpr) ). rxfg rxbg tx0 rxf txe prio tx1 txe prio tx2 txe prio mscan12 cpu bus 6-mscan12
mscan controller message storage mc68hc912dt128a rev 2.0 motorola mscan controller 275 7-mscan12 in order to transmit a message, the cpu12 has to identify an available transmit buffer which is indicated by a set transmit buffer empty (txe) flag in the mscan12 transmitter flag register (ctflg) (see mscan12 transmitter flag register (ctflg) ). the cpu12 then stores the identifier, the control bits and the data content into one of the transmit buffers. finally, the buffer has to be flagged as being ready for transmission by clearing the txe flag. the mscan12 will then schedule the message for transmission and will signal the successful transmission of the buffer by setting the txe flag. a transmit interrupt will be emitted 1 when txe is set and this can be used to drive the application software to re-load the buffer. in case more than one buffer is scheduled for transmission when the can bus becomes available for arbitration, the mscan12 uses the local priority setting of the three buffers for prioritizing. for this purpose every transmit buffer has an 8-bit local priority field (prio). the application software sets this field when the message is set up. the local priority reflects the priority of this particular message relative to the set of messages being emitted from this node. the lowest binary value of the prio field is defined to be the highest priority. the internal scheduling process takes places whenever the mscan12 arbitrates for the bus. this is also the case after the occurrence of a transmission error. when a high priority message is scheduled by the application software it may become necessary to abort a lower priority message being set up in one of the three transmit buffers. as messages that are already under transmission can not be aborted, the user has to request the abort by setting the corresponding abort request flag (abtrq) in the transmission control register (ctcr). the mscan12 grants the request, if possible, by setting the corresponding abort request acknowledge (abtak) and the txe flag in order to release the buffer and by emitting a transmit interrupt. the transmit interrupt handler software can tell from 1. the transmit interrupt will occur only if not masked. a polling scheme can be applied on txe also.
mscan controller mc68hc912dt128a rev 2.0 276 mscan controller motorola the setting of the abtak flag whether the message was actually aborted (abtak=1) or sent in the meantime (abtak=0). identifier acceptance filter a very flexible programmable generic identifier acceptance filter has been introduced in order to reduce the cpu interrupt loading. the filter is programmable to operate in four different modes:  two identifier acceptance filters, each to be applied to the full 29 bits of the identifier and to the following bits of the can frame: rtr, ide, srr. this mode implements a two filters for a full length can 2.0b compliant extended identifier. figure 43 shows how the first 32-bit filter bank (cidar0 ? 3, cidmr0 ? 3) produces a filter 0 hit. similarly, the second filter bank (cidar4 ? 7, cidmr4 ? 7) produces a filter 1 hit.  four identifier acceptance filters, each to be applied to a) the 11 bits of the identifier and the rtr bit of can 2.0a messages or b) the 14 most significant bits of the identifier of can 2.0b messages. figure 44 shows how the first 32-bit filter bank (cidar0 ? 3, cidmr0 ? 3) produces filter 0 and 1 hits. similarly, the second filter bank (cidar4 ? 7, cidmr4 ? 7) produces filter 2 and 3 hits.  eight identifier acceptance filters, each to be applied to the first 8 bits of the identifier. this mode implements eight independent filters for the first 8 bit of a can 2.0a compliant standard identifier or of a can 2.0b compliant extended identifier. figure 45 shows how the first 32-bit filter bank (cidar0 ? 3, cidmr0 ? 3) produces filter 0 to 3 hits. similarly, the second filter bank (cidar4 ? 7, cidmr4 ? 7) produces filter 4 to 7 hits.  closed filter. no can message will be copied into the foreground buffer rxfg, and the rxf flag will never be set. 8-mscan12
mscan controller identifier acceptance filter mc68hc912dt128a rev 2.0 motorola mscan controller 277 9-mscan12 figure 43 32-bit maskable identifier acceptance filters figure 44 16-bit maskable acceptance filters cidmr2 id28 id21 id20 id15 id14 id7 id6 rtr id10 id3 id2 ide am7 idr0 idr0 idr1 idr1 idr2 idr3 am0 am7 am0 am7 am7 am0 am0 ac7 ac0 ac7 ac0 ac7 ac0 ac7 ac0 cidmro cidmr1 cidmr3 cidar3 cidar2 cidar1 cidaro id accepted (filter 0 hit) id28 id21 id20 id15 id14 id7 id6 rtr id10 id3 id2 ide am7 idr0 idr0 idr1 idr1 idr2 idr3 am0 am7 am0 ac7 ac0 ac7 ac0 cidmro cidmr1 cidar1 cidaro id accepted (filter 0 hit) id accepted (filter 1 hit) am7 am0 am7 am0 ac7 ac0 ac7 ac0 cidmr2 cidmr3 cidar3 cidar2
mscan controller mc68hc912dt128a rev 2.0 278 mscan controller motorola figure 45 8-bit maskable acceptance filters the identifier acceptance registers (cidar0 ? 7) define the acceptable patterns of the standard or extended identifier (id10 ? id0 or id28 ? id0). any of these bits can be marked don ? t care in the identifier mask registers (cidmr0 ? 7). a filter hit is indicated to the application software by a set rxf (receive buffer full flag, see mscan12 receiver flag register (crflg) ) and id28 id21 id20 id15 id14 id7 id6 rtr id10 id3 id2 ide am7 idr0 idr0 idr1 idr1 idr2 idr3 am0 ac7 ac0 cidmro cidaro id accepted (filter 0 hit) am7 am0 ac7 ac0 cidmr1 cidar1 am7 am0 ac7 ac0 cidmr2 cidar2 id accepted (filter 1 hit) id accepted (filter 2 hit) am7 am0 ac7 ac0 cidmr3 cidar3 10-mscan12
mscan controller interrupts mc68hc912dt128a rev 2.0 motorola mscan controller 279 11-mscan12 three bits in the identifier acceptance control register (see mscan12 identifier acceptance control register (cidac) ). these identifier hit flags (idhit2 ? 0) clearly identify the filter section that caused the acceptance. they simplify the application software ? s task to identify the cause of the receiver interrupt. in case that more than one hit occurs (two or more filters match) the lower hit has priority. a hit will also cause a receiver interrupt if enabled. interrupts the mscan12 supports four interrupt vectors mapped onto eleven different interrupt sources, any of which can be individually masked (for details see mscan12 receiver flag register (crflg) to mscan12 transmitter control register (ctcr) ):  transmit interrupt : at least one of the three transmit buffers is empty (not scheduled) and can be loaded to schedule a message for transmission. the txe flags of the empty message buffers are set.  receive interrupt : a message has been successfully received and loaded into the foreground receive buffer. this interrupt will be emitted immediately after receiving the eof symbol. the rxf flag is set.  wake-up interrupt : an activity on the can bus occurred during mscan12 internal sleep mode.  error interrupt : an overrun, error or warning condition occurred. the receiver flag register (crflg) will indicate one of the following conditions: ? overrun: an overrun condition as described in receive structures has occurred. ? receiver warning : the receive error counter has reached the cpu warning limit of 96. ? transmitter warning : the transmit error counter has reached the cpu warning limit of 96.
mscan controller mc68hc912dt128a rev 2.0 280 mscan controller motorola ? receiver error passive : the receive error counter has exceeded the error passive limit of 127 and mscan12 has gone to error passive state. ? transmitter error passive : the transmit error counter has exceeded the error passive limit of 127 and mscan12 has gone to error passive state. ? bus off : the transmit error counter has exceeded 255 and mscan12 has gone to busoff state. interrupt acknowledge interrupts are directly associated with one or more status flags in either the mscan12 receiver flag register (crflg) or the mscan12 transmitter flag register (ctflg). interrupts are pending as long as one of the corresponding flags is set. the flags in above registers must be reset within the interrupt handler in order to handshake the interrupt. the flags are reset through writing a 1 to the corresponding bit position. a flag can not be cleared if the respective condition still prevails. note: bit manipulation instructions (bset) shall not be used to clear interrupt flags. interrupt vectors the mscan12 supports four interrupt vectors as shown in table 38 . the vector addresses and the relative interrupt priority are dependent on the chip integration and to be defined. 12-mscan12
mscan controller protocol violation protection mc68hc912dt128a rev 2.0 motorola mscan controller 281 13-mscan12 protocol violation protection the mscan12 will protect the user from accidentally violating the can protocol through programming errors. the protection logic implements the following features:  the receive and transmit error counters cannot be written or otherwise manipulated.  all registers which control the configuration of the mscan12 can not be modified while the mscan12 is on-line. the sftres bit in cmcr0 (see mscan12 module control register (cmcr0) ) serves as a lock to protect the following registers: ? mscan12 module control register 1 (cmcr1) ? mscan12 bus timing register 0 and 1 (cbtr0, cbtr1) ? mscan12 identifier acceptance control register (cidac) ? mscan12 identifier acceptance registers (cidar0 ? 7) ? mscan12 identifier mask registers (cidmr0 ? 7)  the txcan pin is forced to recessive when the mscan12 is in any of the low power modes. table 38 mscan12 interrupt vectors function source local mask global mask wake-up wupif wupie i bit error interrupts rwrnif rwrnie twrnif twrnie rerrif rerrie terrif terrie boffif boffie ovrif ovrie receive rxf rxfie transmit txe0 txeie0 txe1 txeie1 txe2 txeie2
mscan controller mc68hc912dt128a rev 2.0 282 mscan controller motorola low power modes the mscan12 has three modes with reduced power consumption compared to normal mode. in sleep and soft_reset mode, power consumption is reduced by stopping all clocks except those to access the registers. in power_down mode, all clocks are stopped and no power is consumed. the wai and stop instructions put the mcu in low power consumption stand-by modes. table 39 summarizes the combinations of mscan12 and cpu modes. a particular combination of modes is entered for the given settings of the bits cswai, slpak, and sftres. for all modes, an mscan wake-up interrupt can occur only if slpak=wupie=1. while the cpu is in wait mode, the mscan12 can be operated in normal mode and emit interrupts (registers can be accessed via background debug mode). mscan12 sleep mode the cpu can request the mscan12 to enter this low-power mode by asserting the slprq bit in the module configuration register (see figure 46 ). the time when the mscan12 will then enter sleep mode depends on its current activity: table 39 mscan12 vs. cpu operating modes mscan mode cpu mode stop wait run power_down cswai = x (1) slpak = x sftres = x 1. x means don ? t care. cswai = 1 slpak = x sftres = x sleep cswai = 0 slpak = 1 sftres = 0 cswai = x slpak = 1 sftres = 0 soft_reset cswai = 0 slpak = 0 sftres = 1 cswai = x slpak = 0 sftres = 1 normal cswai = 0 slpak = 0 sftres = 0 cswai = x slpak = 0 sftres = 0 14-mscan12
mscan controller low power modes mc68hc912dt128a rev 2.0 motorola mscan controller 283 15-mscan12  if it is transmitting, it will continue to transmit until there is no more message to be transmitted, and then go into sleep mode  if it receiving, it will wait for the end of this message and then go into sleep mode  if it is neither transmitting nor receiving, it will immediately go into sleep mode the application software must avoid setting up a transmission (by clearing one or more txe flag(s)) and immediately request sleep mode (by setting slprq). it will then depend on the exact sequence of operations whether the mscan12 will start transmitting or go into sleep mode directly. during sleep mode, the slpak flag is set. the application software should use slpak as a handshake indication for the request (slprq) to go into sleep mode. when in sleep mode, the mscan12 stops its internal clocks. clocks to allow register accesses will still run. the txcan pin will stay in recessive state. if rxf=1, the message can be read and rxf can be cleared. however, if the mscan12 is in bus-off state, it stops counting 128*11 consecutive recessive bits due to the stopped clocks. likewise, copying of rxbg into rxfg will not take place while in sleep mode. it is possible to access the transmit buffers and to clear the txe flags. no message abort will take place while in sleep mode. the mscan12 will leave sleep mode (wake-up) when  bus activity occurs or  the mcu clears the slprq bit or  the mcu sets sftres. note: the mcu cannot clear the slprq bit before the mscan12 is in sleep mode (slpak = 1). after wake-up, the mscan12 waits for 11 consecutive recessive bits to synchronize to the bus. as a consequence, if the mscan12 is woken-up by a can frame, this frame will not be received. the receive message buffers (rxbg and rxfg) will contain messages if they were received before sleep mode was entered. pending copying of rxbg and rxfg,
mscan controller mc68hc912dt128a rev 2.0 284 mscan controller motorola as well as pending message aborts and pending message transmissions, will now be executed. if the mscan12 is still in bus-off state after sleep mode was left, it continues counting the 128*11 consecutive recessive bits. figure 46 sleep request / acknowledge cycle mscan12 soft_reset mode in soft_reset mode, the mscan12 is stopped. registers can still be accessed. this mode is used to initialize the module configuration, bit timing, and the can message filter. see mscan12 module control register (cmcr0) for a complete description of the soft_reset mode. when setting the sftres bit, the mscan12 immediately stops all ongoing transmissions and receptions, potentially causing the can protocol violations. the user is responsible to take care that the mscan12 is not active when soft_reset mode is entered. the recommended procedure is to bring the mscan12 into sleep mode before the sftres bit is set. mscan12 sleeping slprq = 1 slpak = 1 mscan12 running slprq = 0 slpak = 0 sleep request slprq = 1 slpak = 0 mcu mscan12 mcu or mscan12 16-mscan12
mscan controller timer link mc68hc912dt128a rev 2.0 motorola mscan controller 285 17-mscan12 mscan12 power_down mode the mscan12 is in power_down mode when  the cpu is in stop mode or  the cpu is in wait mode and the cswai bit is set (see mscan12 module control register (cmcr0) ). when entering the power_down mode, the mscan12 immediately stops all ongoing transmissions and receptions, potentially causing can protocol violations. the user is responsible to take care that the mscan12 is not active when power_down mode is entered. the recommended procedure is to bring the mscan12 into sleep mode before the stop instruction (or the wai instruction, if cswai is set) is executed. to protect the can bus system from fatal consequences of violations to above rule, the mscan12 will drive the txcan pin into recessive state. in power_down mode, no registers can be accessed. programmable wake-up function the mscan12 can be programmed to apply a low-pass filter function to the rxcan input line while in sleep mode (see control bit wupm in the module control register, mscan12 module control register (cmcr0) ). this feature can be used to protect the mscan12 from wake-up due to short glitches on the can bus lines. such glitches can result from electromagnetic inference within noisy environments. timer link the mscan12 will generate a timer signal whenever a valid frame has been received. because the can specification defines a frame to be valid if no errors occurred before the eof field has been transmitted successfully, the timer signal will be generated right after the eof. a pulse of one bit time is generated. as the mscan12 receiver engine receives also the frames being sent by itself, a timer signal will also be generated after a successful transmission.
mscan controller mc68hc912dt128a rev 2.0 286 mscan controller motorola the previously described timer signal can be routed into the on-chip timer module (ect). under the control of the timer link enable (tlnken) bit in the cmcr0, this signal will be connected to the ect timer channel m input 1 . after ect timer has been programmed to capture rising edge events, it can be used under software control to generate 16-bit time stamps which can be stored with the received message. clock system figure 47 shows the structure of the mscan12 clock generation circuitry. with this flexible clocking scheme the mscan12 is able to handle can bus rates ranging from 10 kbps up to 1 mbps. figure 47 clocking scheme the clock source bit (clksrc) in the mscan12 module control register (cmcr1) (see mscan12 bus timing register 0 (cbtr0) ) defines whether the mscan12 is connected to the output of the crystal oscillator (extali) or to the system clock (sysclk). the clock source has to be chosen such that the tight oscillator tolerance requirements (up to 0.4%) of the can protocol are met. additionally, for high can bus rates (1 mbps), a 50% duty cycle of the clock is required. 1. the timer channel being used for the timer link for can0 is channel 4 and for can1 is channel 5. mscan12 cgm sysclk extali cgmcanclk prescaler (1...64) time quanta clock clksrc clksrc 18-mscan12
mscan controller clock system mc68hc912dt128a rev 2.0 motorola mscan controller 287 19-mscan12 for microcontrollers without the cgm module, cgmcanclk is driven from the crystal oscillator (extali). a programmable prescaler is used to generate out of mscanclk the time quanta (tq) clock. a time quantum is the atomic unit of time handled by the mscan12. a bit time is subdivided into three segments 1 :  sync_seg: this segment has a fixed length of one time quantum. signal edges are expected to happen within this section.  time segment 1: this segment includes the prop_seg and the phase_seg1 of the can standard. it can be programmed by setting the parameter tseg1 to consist of 4 to 16 time quanta.  time segment 2: this segment represents the phase_seg2 of the can standard. it can be programmed by setting the tseg2 parameter to be 2 to 8 time quanta long. the synchronization jump width can be programmed in a range of 1 to 4 time quanta by setting the sjw parameter. above parameters can be set by programming the bus timing registers (cbtr0 ? 1, see mscan12 bus timing register 0 (cbtr0) and mscan12 bus timing register 1 (cbtr1) ). it is the user ? s responsibility to make sure that his bit time settings are in compliance with the can standard. figure 49 gives an overview on the can conforming segment settings and the related parameter values. 1. for further explanation of the under-lying concepts please refer to iso/dis 11519-1, section 10.3.
mscan controller mc68hc912dt128a rev 2.0 288 mscan controller motorola figure 48 segments within the bit time memory map the mscan12 occupies 128 bytes in the cpu12 memory space. the background receive buffer can only be read in test mode. figure 49 can standard compliant bit time segment settings time segment 1 tseg1 time segment 2 tseg2 synchron. jump width sjw 5 .. 10 4 .. 9 2 1 1 .. 2 0 .. 1 4 .. 11 3 .. 10 3 2 1 .. 3 0 .. 2 5 .. 12 4 .. 11 4 3 1 .. 4 0 .. 3 6 .. 13 5 .. 12 5 4 1 .. 4 0 .. 3 7 .. 14 6 .. 13 6 5 1 .. 4 0 .. 3 8 .. 15 7 .. 14 7 6 1 .. 4 0 .. 3 9 .. 16 8 .. 15 8 7 1 .. 4 0 .. 3 sync _seg time segment 1 time seg. 2 1 4 ... 16 2 ... 8 8... 25 time quanta = 1 bit time nrz signal sample point (single or triple sampling) (prop_seg + phase_seg1) (phase_seg2) transmit point 20-mscan12
mscan controller programmer ? s model of message storage mc68hc912dt128a rev 2.0 motorola mscan controller 289 21-mscan12 programmer ? s model of message storage the following section details the organization of the receive and transmit message buffers and the associated control registers. for reasons of programmer interface simplification the receive and transmit message buffers have the same outline. each message buffer allocates 16 bytes in the memory map containing a 13 byte data structure. an additional transmit buffer priority register (tbpr) is defined for the transmit buffers. figure 50 mscan12 memory map $0100 control registers 9 bytes $0108 $0109 reserved 5 bytes $010d $010e error counters 2 bytes $010f $0110 identifier filter 16 bytes $011f $0120 reserved 29 bytes $013c $013d port can registers 3 bytes $013f $0140 foreground receive buffer $014f $0150 transmit buffer 0 $015f $0160 transmit buffer 1 $016f $0170 transmit buffer 2 $017f
mscan controller mc68hc912dt128a rev 2.0 290 mscan controller motorola message buffer outline figure 52 shows the common 13 byte data structure of receive and transmit buffers for extended identifiers. the mapping of standard identifiers into the idr registers is shown in figure 53 . all bits of the 13 byte data structure are undefined out of reset. note: the foreground receive buffer can be read anytime but can not be written. the transmit buffers can be read or written anytime. figure 51 message buffer organization address (1) 1. x is 4, 5, 6, or 7 depending on which buffer rxfg, tx0, tx1, or tx2 respectively. register name 01x0 identifier register 0 01x1 identifier register 1 01x2 identifier register 2 01x3 identifier register 3 01x4 data segment register 0 01x5 data segment register 1 01x6 data segment register 2 01x7 data segment register 3 01x8 data segment register 4 01x9 data segment register 5 01xa data segment register 6 01xb data segment register 7 01xc data length register 01xd transmit buffer priority register (2) 2. not applicable for receive buffers 01xe unused 01xf unused 22-mscan12
mscan controller programmer ? s model of message storage mc68hc912dt128a rev 2.0 motorola mscan controller 291 23-mscan12 figure 52 receive/transmit message buffer extended identifier addr (1) registerr/wbit 7654321bit 0 $01x0 idr0 r id28 id27 id26 id25 id24 id23 id22 id21 w $01x1 idr1 r id20 id19 id18 srr (1) ide (1) id17 id16 id15 w $01x2 idr2 r id14 id13 id12 id11 id10 id9 id8 id7 w $01x3 idr3 r id6 id5 id4 id3 id2 id1 id0 rtr w $01x4 dsr0 r db7 db6 db5 db4 db3 db2 db1 db0 w $01x5 dsr1 r db7 db6 db5 db4 db3 db2 db1 db0 w $01x6 dsr2 r db7 db6 db5 db4 db3 db2 db1 db0 w $01x7 dsr3 r db7 db6 db5 db4 db3 db2 db1 db0 w $01x8 dsr4 r db7 db6 db5 db4 db3 db2 db1 db0 w $01x9 dsr5 r db7 db6 db5 db4 db3 db2 db1 db0 w $01xa dsr6 r db7 db6 db5 db4 db3 db2 db1 db0 w $01xb dsr7 r db7 db6 db5 db4 db3 db2 db1 db0 w $01xc dlr r dlc3 dlc2 dlc1 dlc0 w 1. x is 4, 5, 6, or 7 depending on which buffer rxfg, tx0, tx1, or tx2 respectively.
mscan controller mc68hc912dt128a rev 2.0 292 mscan controller motorola identifier registers (idrn) the identifiers consist of either 11 bits (id10 ? id0) for the standard, or 29 bits (id28 ? id0) for the extended format. id10/28 is the most significant bit and is transmitted first on the bus during the arbitration procedure. the priority of an identifier is defined to be highest for the smallest binary number. srr ? substitute remote request this fixed recessive bit is used only in extended format. it must be set to 1 by the user for transmission buffers and will be stored as received on the can bus for receive buffers. ide ? id extended this flag indicates whether the extended or standard identifier format is applied in this buffer. in case of a receive buffer the flag is set as being received and indicates to the cpu how to process the buffer identifier registers. in case of a transmit buffer the flag indicates to the mscan12 what type of identifier to send. 0 = standard format (11-bit) 1 = extended format (29-bit) figure 53 standard identifier mapping addr (1) registerr/wbit 7654321bit 0 $01x0 idr0 r id10 id9 id8 id7 id6 id5 id4 id3 w $01x1 idr1 r id2 id1 id0 rtr ide(0) w $01x2 idr2 r w $01x3 idr3 r w 1. x is 4, 5, 6, or 7 depending on which buffer rxfg, tx0, tx1, or tx2 respectively. 24-mscan12
mscan controller programmer ? s model of message storage mc68hc912dt128a rev 2.0 motorola mscan controller 293 25-mscan12 rtr ? remote transmission request this flag reflects the status of the remote transmission request bit in the can frame. in case of a receive buffer it indicates the status of the received frame and allows to support the transmission of an answering frame in software. in case of a transmit buffer this flag defines the setting of the rtr bit to be sent. 0 = data frame 1 = remote frame data length register (dlr) this register keeps the data length field of the can frame. dlc3 ? dlc0 ? data length code bits the data length code contains the number of bytes (data byte count) of the respective message. at transmission of a remote frame, the data length code is transmitted as programmed while the number of transmitted bytes is always 0. the data byte count ranges from 0 to 8 for a data frame. table 40 shows the effect of setting the dlc bits. data segment registers (dsrn) the eight data segment registers contain the data to be transmitted or being received. the number of bytes to be transmitted or being received is determined by the data length code in the corresponding dlr. table 40 data length codes data length code data byte count dlc3 dlc2 dlc1 dlc0 00000 00011 00102 00113 01004 01015 01106 01117 10008
mscan controller mc68hc912dt128a rev 2.0 294 mscan controller motorola transmit buffer priority registers (tbpr) prio7 ? prio0 ? local priority this field defines the local priority of the associated message buffer. the local priority is used for the internal prioritizing process of the mscan12 and is defined to be highest for the smallest binary number. the mscan12 implements the following internal priorization mechanism:  all transmission buffers with a cleared txe flag participate in the priorisation right before the sof (start of frame) is sent.  the transmission buffer with the lowest local priority field wins the priorisation.  in case of more than one buffer having the same lowest priority the message buffer with the lower index number wins. note: to ensure data integrity, no registers of the transmit buffers shall be written while the associated txe flag is cleared. to ensure data integrity, no registers of the receive buffer shall be read while the rxf flag is cleared. programmer ? s model of control registers overview the programmer ? s model has been laid out for maximum simplicity and efficiency. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tbpr (1) 1. x is 5, 6, or 7 depending on which buffer tx0, tx1, or tx2 respectively. r prio7 prio6 prio5 prio4 prio3 prio2 prio1 prio0 $01xd w reset - - - - - - - - 26-mscan12
mscan controller programmer ? s model of control registers mc68hc912dt128a rev 2.0 motorola mscan controller 295 27-mscan12 mscan12 module control register (cmcr0) cswai ? can stops in wait mode 0 = the module is not affected during wait mode. 1 = the module ceases to be clocked during wait mode. synch ? synchronized status this bit indicates whether the mscan12 is synchronized to the can bus and as such can participate in the communication process. 0 = mscan12 is not synchronized to the can bus 1 = mscan12 is synchronized to the can bus tlnken ? timer enable this flag is used to establish a link between the mscan12 and the on-chip timer (see timer link ). 0 = the port is connected to the timer input. 1 = the mscan12 timer signal output is connected to the timer input. slpak ? sleep mode acknowledge this flag indicates whether the mscan12 is in module internal sleep mode. it shall be used as a handshake for the sleep mode request (see mscan12 sleep mode ). 0 = wake-up ? the mscan12 is not in sleep mode. 1 = sleep ? the mscan12 is in sleep mode. slprq ? sleep request this flag allows to request the mscan12 to go into an internal power-saving mode (see mscan12 sleep mode ). 0 = wake-up ? the mscan12 will function normally. 1 = sleep request ? the mscan12 will go into sleep mode. bit 7654321bit 0 cmcr0 r 0 0 cswai synch tlnken slpak slprq sftres $0100 w reset 00100001
mscan controller mc68hc912dt128a rev 2.0 296 mscan controller motorola sftres ? soft_reset when this bit is set by the cpu, the mscan12 immediately enters the soft_reset state. any ongoing transmission or reception is aborted and synchronization to the bus is lost. the following registers will go into and stay in the same state as out of hard reset: cmcr0, crflg, crier, ctflg, ctcr. the registers cmcr1, cbtr0, cbtr1, cidac, cidar0 ? 3, cidmr0 ? 3 can only be written by the cpu when the mscan12 is in soft_reset state. the values of the error counters are not affected by soft_reset. when this bit is cleared by the cpu, the mscan12 will try to synchronize to the can bus: if the mscan12 is not in busoff state it will be synchronized after 11 recessive bits on the bus; if the mscan12 is in busoff state it continues to wait for 128 occurrences of 11 recessive bits. clearing sftres and writing to other bits in cmcr0 must be in separate instructions. 0 = normal operation 1 = mscan12 in soft_reset state. mscan12 module control register (cmcr1) loopb ? loop back self test mode when this bit is set the mscan12 performs an internal loop back which can be used for self test operation: the bit stream output of the transmitter is fed back to the receiver. the rxcan input pin is ignored and the txcan output goes to the recessive state (1). note that in this state the mscan12 ignores the bit sent during the ack slot of the can frame acknowledge field to insure proper reception of its own message and will treat messages being received while in transmission as received messages from remote nodes. 0 = normal operation 1 = activate loop back self test mode bit 7654321bit 0 cmcr1 r 0 0 0 0 0 loopb wupm clksrc $0101 w reset 0 0 0 0 0 0 0 0 28-mscan12
mscan controller programmer ? s model of control registers mc68hc912dt128a rev 2.0 motorola mscan controller 297 29-mscan12 wupm ? wake-up mode this flag defines whether the integrated low-pass filter is applied to protect the mscan12 from spurious wake-ups (see programmable wake-up function ). 0 = mscan12 will wake up the cpu after any recessive to dominant edge on the can bus. 1 = mscan12 will wake up the cpu only in case of dominant pulse on the bus which has a length of at least approximately t wup . clksrc ? mscan12 clock source this flag defines which clock source the mscan12 module is driven from (only for system with cgm module; see clock system , figure 47 ). 0 = the mscan12 clock source is extali. 1 = the mscan12 clock source is sysclk, twice the frequency of eclk. note: the cmcr1 register can only be written if the sftres bit in cmcr0 is set. mscan12 bus timing register 0 (cbtr0) sjw1, sjw0 ? synchronization jump width the synchronization jump width defines the maximum number of time quanta (tq) clock cycles by which a bit may be shortened, or lengthened, to achieve resynchronization on data transitions on the bus (see table 41 ). bit 7654321bit 0 cbtr0 r sjw1 sjw0 brp5 brp4 brp3 brp2 brp1 brp0 $0102 w reset 0 0000000
mscan controller mc68hc912dt128a rev 2.0 298 mscan controller motorola brp5 ? brp0 ? baud rate prescaler these bits determine the time quanta (tq) clock, which is used to build up the individual bit timing, according to table 42 . note: the cbtr0 register can only be written if the sftres bit in cmcr0 is set. mscan12 bus timing register 1 (cbtr1) samp ? sampling this bit determines the number of samples of the serial bus to be taken per bit time. if set three samples per bit are taken, the regular one (sample point) and two preceding samples, using a majority rule. for higher bit rates samp should be cleared, which means that only one sample will be taken per bit. table 41 synchronization jump width sjw1 sjw0 synchronization jump width 0 0 1 tq clock cycle 0 1 2 tq clock cycles 1 0 3 tq clock cycles 1 1 4 tq clock cycles table 42 baud rate prescaler brp5 brp4 brp3 brp2 brp1 brp0 prescaler value (p) 000000 1 000001 2 000010 3 000011 4 :::::: : :::::: : 111111 64 bit 7654321bit 0 cbtr1 r samp tseg22 tseg21 tseg20 tseg13 tseg12 tseg11 tseg10 $0103 w reset 00000000 30-mscan12
mscan controller programmer ? s model of control registers mc68hc912dt128a rev 2.0 motorola mscan controller 299 31-mscan12 0 = one sample per bit. 1 = three samples per bit 1 . tseg22 ? tseg10 ? time segment time segments within the bit time fix the number of clock cycles per bit time, and the location of the sample point. time segment 1 (tseg1) and time segment 2 (tseg2) are programmable as shown in table 44 . the bit time is determined by the oscillator frequency, the baud rate prescaler, and the number of time quanta (tq) clock cycles per bit (as shown above). note: the cbtr1 register can only be written if the sftres bit in cmcr0 is set. mscan12 receiver flag register (crflg) all bits of this register are read and clear only. a flag can be cleared by writing a 1 to the corresponding bit position. a flag can only be cleared when the condition which caused the setting is no more valid. writing a 1. in this case phase_seg1 must be at least 2 timequanta. table 43 time segment syntax sync_seg system expects transitions to occur on the bus during this period. transmit point a node in transmit mode will transfer a new value to the can bus at this point. sample point a node in receive mode will sample the bus at this point. if the three samples per bit option is selected then this point marks the position of the third sample. table 44 time segment values tseg13 tseg12 tseg11 tseg10 time segment 1 tseg22 tseg21 tseg20 time segment 2 0 0 0 0 1 tq clock cycle 0 0 0 1 tq clock cycle 0 0 0 1 2 tq clock cycles 0 0 1 2 tq clock cycles 0 0 1 0 3 tq clock cycles . . . . 0 0 1 1 4 tq clock cycles . . . . . . . . . 1 1 1 8 tq clock cycles .... . 1 1 1 1 16 tq clock cycles
mscan controller mc68hc912dt128a rev 2.0 300 mscan controller motorola 0 has no effect on the flag setting. every flag has an associated interrupt enable flag in the crier register. a hard or soft reset will clear the register. wupif ? wake-up interrupt flag if the mscan12 detects bus activity while it is in sleep mode, it clears the slpak bit in the cmcr0 register; the wupif bit will then be set. if not masked, a wake-up interrupt is pending while this flag is set. 0 = no wake-up activity has been observed while in sleep mode. 1 = mscan12 has detected activity on the bus and requested wake-up. rwrnif ? receiver warning interrupt flag this bit will be set when the mscan12 goes into warning status due to the receive error counter (rec) exceeding 96 and neither one of the error interrupt flags or the bus-off interrupt flag is set 1 . if not masked, an error interrupt is pending while this flag is set. 0 = no receiver warning status has been reached. 1 = mscan12 went into receiver warning status. twrnif ? transmitter warning interrupt flag this bit will be set when the mscan12 goes into warning status due to the transmit error counter (tec) exceeding 96 and neither one of the error interrupt flags or the bus-off interrupt flag is set 2 . if not masked, an error interrupt is pending while this flag is set. 0 = no transmitter warning status has been reached. 1 = mscan12 went into transmitter warning status. bit 7654321bit 0 crflg r wupif rwrnif twrnif rerrif terrif boffif ovrif rxf $0104 w reset00000000 1. rwrnif = (96 < rec) & rerrif & terrif & boffif 2. twrnif = (96 < tec) & rerrif & terrif & boffif 32-mscan12
mscan controller programmer ? s model of control registers mc68hc912dt128a rev 2.0 motorola mscan controller 301 33-mscan12 rerrif ? receiver error passive interrupt flag this bit will be set when the mscan12 goes into error passive status due to the receive error counter (rec) exceeding 127 and the bus-off interrupt flag is not set 1 . if not masked, an error interrupt is pending while this flag is set. 0 = no receiver error passive status has been reached. 1 = mscan12 went into receiver error passive status. terrif ? transmitter error passive interrupt flag this bit will be set when the mscan12 goes into error passive status due to the transmit error counter (tec) exceeding 127 and the bus-off interrupt flag is not set 2 . if not masked, an error interrupt is pending while this flag is set. 0 = no transmitter error passive status has been reached. 1 = mscan12 went into transmitter error passive status. boffif ? busoff interrupt flag this bit will be set when the mscan12 goes into busoff status, due to the transmit error counter exceeding 255. it cannot be cleared before the mscan12 has monitored 128*11 consecutive recessive bits on the bus. if not masked, an error interrupt is pending while this flag is set. 0 = no busoff status has been reached. 1 = mscan12 went into busoff status. ovrif ? overrun interrupt flag this bit will be set when a data overrun condition occurred. if not masked, an error interrupt is pending while this flag is set. 0 = no data overrun has occurred. 1 = a data overrun has been detected. rxf ? receive buffer full the rxf flag is set by the mscan12 when a new message is available in the foreground receive buffer. this flag indicates whether the buffer is loaded with a correctly received message. after the cpu 1. rerrif = (128 < rec < 255) & boffif 2. terrif = (128 < tec < 255) & boffif
mscan controller mc68hc912dt128a rev 2.0 302 mscan controller motorola has read that message from the receive buffer the rxf flag must be handshaked (cleared) in order to release the buffer. a set rxf flag prohibits the exchange of the background receive buffer into the foreground buffer. if not masked, a receive interrupt is pending while this flag is set. 0 = the receive buffer is released (not full). 1 = the receive buffer is full. a new message is available. note: the crflg register is held in the reset state if the sftres bit in cmcr0 is set. mscan12 receiver interrupt enable register (crier) wupie ? wake-up interrupt enable 0 = no interrupt will be generated from this event. 1 = a wake-up event will result in a wake-up interrupt. rwrnie ? receiver warning interrupt enable 0 = no interrupt will be generated from this event. 1 = a receiver warning status event will result in an error interrupt. twrnie ? transmitter warning interrupt enable 0 = no interrupt will be generated from this event. 1 = a transmitter warning status event will result in an error interrupt. rerrie ? receiver error passive interrupt enable 0 = no interrupt will be generated from this event. 1 = a receiver error passive status event will result in an error interrupt. terrie ? transmitter error passive interrupt enable 0 = no interrupt will be generated from this event. 1 = a transmitter error passive status event will result in an error interrupt. bit 7654321bit 0 crier r wupie rwrnie twrnie rerrie terrie boffie ovrie rxfie $0105 w reset 00000000 34-mscan12
mscan controller programmer ? s model of control registers mc68hc912dt128a rev 2.0 motorola mscan controller 303 35-mscan12 boffie ? busoff interrupt enable 0 = no interrupt will be generated from this event. 1 = a busoff event will result in an error interrupt. ovrie ? overrun interrupt enable 0 = no interrupt will be generated from this event. 1 = an overrun event will result in an error interrupt. rxfie ? receiver full interrupt enable 0 = no interrupt will be generated from this event. 1 = a receive buffer full (successful message reception) event will result in a receive interrupt. note: the crier register is held in the reset state if the sftres bit in cmcr0 is set. mscan12 transmitter flag register (ctflg) the abort acknowledge flags are read only. the transmitter buffer empty flags are read and clear only. a flag can be cleared by writing a1 to the corresponding bit position. writing a zero has no effect on the flag setting. the transmitter buffer empty flags each have an associated interrupt enable flag in the ctcr register. a hard or soft reset will reset the register. abtak2 ? abtak0 ? abort acknowledge this flag acknowledges that a message has been aborted due to a pending abort request from the cpu. after a particular message buffer has been flagged empty, this flag can be used by the application software to identify whether the message has been aborted successfully or has been sent in the meantime. the flag is reset implicitly whenever the associated txe flag is set to 0. 0 = the massage has not been aborted, thus has been sent out. 1 = the message has been aborted. bit 7654321bit 0 ctflg r 0 abtak2 abtak1 abtak0 0 txe2 txe1 txe0 $0106 w reset 0 0 0 0 0 1 1 1
mscan controller mc68hc912dt128a rev 2.0 304 mscan controller motorola txe2 ? txe0 ? transmitter buffer empty this flag indicates that the associated transmit message buffer is empty, thus not scheduled for transmission. the cpu must handshake (clear) the flag after a message has been set up in the transmit buffer and is due for transmission. the mscan12 will set the flag after the message has been sent successfully. the flag will also be set by the mscan12 when the transmission request was successfully aborted due to a pending abort request ( mscan12 transmitter control register (ctcr) ). if not masked, a transmit interrupt is pending while this flag is set. clearing this flag will also clear the corresponding abort acknowledge flag (abtak, see above). setting this flag will clear the corresponding abort request flag (abtrq, mscan12 transmitter control register (ctcr) ). 0 = the associated message buffer is full (loaded with a message due for transmission). 1 = the associated message buffer is empty (not scheduled). note: the ctflg register is held in the reset state if the sftres bit in cmcr0 is set. mscan12 transmitter control register (ctcr) abtrq2 ? abtrq0 ? abort request the cpu sets this bit to request that an already scheduled message buffer (txe = 0) shall be aborted. the mscan12 will grant the request when the message is not already under transmission. when a message is aborted the associated txe and the abort acknowledge flag (abtak, see mscan12 transmitter flag register (ctflg) ) will be set and an txe interrupt will occur if enabled. the cpu can not reset abtrqx. abtrqx is reset implicitly whenever the associated txe flag is set. 0 = no abort request. 1 = abort request pending. bit 7654321bit 0 ctcr r 0 abtrq2 abtrq1 abtrq0 0 txeie2 txeie1 txeie0 $0107 w reset 0 0 0 0 0 0 0 0 36-mscan12
mscan controller programmer ? s model of control registers mc68hc912dt128a rev 2.0 motorola mscan controller 305 37-mscan12 note: the software must not clear one or more of the txe flags in ctfgl and simultaneously set the respective abtrq bit(s). txeie2 ? txeie0 ? transmitter empty interrupt enable 0 = no interrupt will be generated from this event. 1 = a transmitter empty (transmit buffer available for transmission) event will result in a transmitter empty interrupt. note: the ctcr register is held in the reset state if the sftres bit in cmcr0 is set. mscan12 identifier acceptance control register (cidac) idam1 ? idam0 ? identifier acceptance mode the cpu sets these flags to define the identifier acceptance filter organization (see identifier acceptance filter ). table 44 summarizes the different settings. in filter closed mode no messages will be accepted such that the foreground buffer will never be reloaded. idhit2 ? idhit0 ? identifier acceptance hit indicator the mscan12 sets these flags to indicate an identifier acceptance hit (see identifier acceptance filter ). table 44 summarizes the different settings. bit 7654321bit 0 cidac r 0 0 idam1 idam0 0 idhit2 idhit1 idhit0 $0108 w reset 0 0 0 0 0 0 0 0 table 45 identifier acceptance mode settings idam1 idam0 identifier acceptance mode 0 0 two 32 bit acceptance filters 0 1 four 16 bit acceptance filters 1 0 eight 8 bit acceptance filters 1 1 filter closed
mscan controller mc68hc912dt128a rev 2.0 306 mscan controller motorola the idhit indicators are always related to the message in the foreground buffer. when a message gets copied from the background to the foreground buffer the indicators are updated as well. note: the cidac register can only be written if the sftres bit in cmcr0 is set. mscan12 receive error counter (crxerr) this register reflects the status of the mscan12 receive error counter. the register is read only. mscan12 transmit error counter (ctxerr) this register reflects the status of the mscan12 transmit error counter. the register is read only. note: both error counters must only be read when in sleep or soft_reset mode. table 46 identifier acceptance hit indication idhit2 idhit1 idhit0 identifier acceptance hit 000 filter 0 hit 001 filter 1 hit 010 filter 2 hit 011 filter 3 hit 100 filter 4 hit 101 filter 5 hit 110 filter 6 hit 111 filter 7 hit bit 7654321bit 0 crxerr r rxerr7 rxerr6 rxerr5 rxerr4 rxerr3 rxerr2 rxerr1 rxerr0 $010e w reset 00000000 bit 7654321bit 0 ctxerr r txerr7 txerr6 txerr5 txerr4 txerr3 txerr2 txerr1 txerr0 $010f w reset 0 0000000 38-mscan12
mscan controller programmer ? s model of control registers mc68hc912dt128a rev 2.0 motorola mscan controller 307 39-mscan12 mscan12 identifier acceptance registers (cidar0 ? 7) on reception each message is written into the background receive buffer. the cpu is only signalled to read the message however, if it passes the criteria in the identifier acceptance and identifier mask registers (accepted); otherwise, the message will be overwritten by the next message (dropped). the acceptance registers of the mscan12 are applied on the idr0 to idr3 registers of incoming messages in a bit by bit manner. for extended identifiers all four acceptance and mask registers are applied. for standard identifiers only the first two (cidmr0/1 and cidar0/1) are applied. in the latter case it is required to program the three last bits (am2 ? am0) in the mask register cidmr1 to ? don ? t care ? . figure 54 identifier acceptance registers (1st bank) bit 7654321bit 0 cidar0 r ac7ac6ac5ac4ac3ac2ac1ac0 $0110 w cidar1 r ac7ac6ac5ac4ac3ac2ac1ac0 $0111 w cidar2 r ac7ac6ac5ac4ac3ac2ac1ac0 $0112 w cidar3 r ac7ac6ac5ac4ac3ac2ac1ac0 $0113 w reset-------- figure 55 identifier acceptance registers (2nd bank) bit 7654321bit 0 cidar4 r ac7 ac6 ac5 ac4 ac3 ac2 ac1 ac0 $0118 w cidar5 r ac7 ac6 ac5 ac4 ac3 ac2 ac1 ac0 $0119 w cidar6 r ac7 ac6 ac5 ac4 ac3 ac2 ac1 ac0 $011a w cidar7 r ac7 ac6 ac5 ac4 ac3 ac2 ac1 ac0 $011b w reset--------
mscan controller mc68hc912dt128a rev 2.0 308 mscan controller motorola ac7 ? ac0 ? acceptance code bits ac7 ? ac0 comprise a user defined sequence of bits with which the corresponding bits of the related identifier register (idrn) of the receive message buffer are compared. the result of this comparison is then masked with the corresponding identifier mask register. note: the cidar0?7 registers can only be written if the sftres bit in cmcr0 is set. mscan12 identifier mask registers (cidmr0 ? 7) the identifier mask register specifies which of the corresponding bits in the identifier acceptance register are relevant for acceptance filtering. figure 56 identifier mask registers (1st bank) bit 7654321bit 0 cidmr0 r am7 am6 am5 am4 am3 am2 am1 am0 $0114 w cidmr1 r am7 am6 am5 am4 am3 am2 am1 am0 $0115 w cidmr2 r am7 am6 am5 am4 am3 am2 am1 am0 $0116 w cidmr3 r am7 am6 am5 am4 am3 am2 am1 am0 $0117 w reset-------- figure 57 identifier mask registers (2nd bank) bit 7654321bit 0 cidmr4 r am7am6am5am4am3am2am1am0 $011c w cidmr5 r am7am6am5am4am3am2am1am0 $011d w cidmr6 r am7am6am5am4am3am2am1am0 $011e w cidmr7 r am7am6am5am4am3am2am1am0 $011f w reset-------- 40-mscan12
mscan controller programmer ? s model of control registers mc68hc912dt128a rev 2.0 motorola mscan controller 309 41-mscan12 am7 ? am0 ? acceptance mask bits if a particular bit in this register is cleared this indicates that the corresponding bit in the identifier acceptance register must be the same as its identifier bit, before a match will be detected. the message will be accepted if all such bits match. if a bit is set, it indicates that the state of the corresponding bit in the identifier acceptance register will not affect whether or not the message is accepted. 0 = match corresponding acceptance code register and identifier bits. 1 = ignore corresponding acceptance code register bit. note: the cidmr0 ? 7 registers can only be written if the sftres bit in cmcr0 is set. mscan12 port can control register (pctlcan) the following bits control pins 7 through 2 of port can when they are implemented externally. pupcan ? pull-up enable port can 0 = pull mode disabled for port can. 1 = pull mode enabled for port can. rdpcan ? reduced drive port can 0 = reduced drive disabled for port can. 1 = reduced drive enabled for port can. bit 7654321bit 0 pctlcanr000000 pupcan rdpcan $013d w reset 0 0000000
mscan controller mc68hc912dt128a rev 2.0 310 mscan controller motorola mscan12 port can data register (portcan) port bits 7 to 2 will read zero when configured as inputs because they are not implemented externally. when configured as output, port bits 7 to 2 will read the last value written. reading bits 1 and 0 returns the value of the txcan and rxcan pins, respectively. mscan12 port can data direction register (ddrcan) ddcan7 ? ddcan2 ? this bits served as memory locations since there are no corresponding external port pins. bit 7654321bit 0 portcan r pcan7 pcan6 pcan5 pcan4 pcan3 pcan2 txcan rxcan $013e w reset ----- bit 7654321bit 0 ddrcan r ddcan7 ddcan6 ddcan5 ddcan4 ddcan3 ddcan2 00 $013f w reset00000000 42-mscan12
mc68hc912dt128a rev 2.0 motorola analog-to-digital converter (atd) 311 analog-to-digital converter (atd) analog-to-digital converter contents introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311 functional description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312 atd registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313 atd mode operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325 introduction the mc68hc912dt128a has two identical atd modules identified as atd0 and atd1. except for the v dda and v ssa analog supply voltage, all pins are duplicated and indexed with ? 0 ? or ? 1 ? in the following description. an ? x ? indicates either ? 0 ? or ? 1 ? . the atd module is an 8-channel, 10-bit or 8-bit, multiplexed-input successive-approximation analog-to-digital converter. it does not require external sample and hold circuits because of the type of charge redistribution technique used. the atd converter timing can be synchronized to the system p clock. the atd module consists of a 16-word (32-byte) memory-mapped control register block used for control, testing and configuration. 1-atd
analog-to-digital converter (atd) mc68hc912dt128a rev 2.0 312 analog-to-digital converter (atd) motorola figure 58 analog-to-digital converter block diagram functional description a single conversion sequence consists of four or eight conversions, depending on the state of the select 8 channel mode (s8cm) bit when atdctl5 is written. there are eight basic conversion modes. in the non-scan modes, the scf bit is set after the sequence of four or eight conversions has been performed and the atd module halts. in the scan modes, the scf bit is set after the first sequence of four or eight conversions has been performed, and the atd module continues to restart the sequence. in both modes, the ccf bit associated with each register is set when that register is loaded with the appropriate conversion result. that flag is cleared automatically when that result register is read. the conversions are started by writing to the control registers. mode and timing controls atd 0 atd 1 atd 2 atd 3 atd 4 atd 5 atd 6 atd 7 sar rc dac array and comparator internal bus v dda v ssa v rlx v rhx clock select/prescale analog mux and sample buffer amp port ad data input register anx7/padx7 anx6/padx6 anx5/padx5 anx4/padx4 anx3/padx3 anx2/padx2 anx1/padx1 anx0/padx0 reference supply hc12 atd block 2--atd
analog-to-digital converter (atd) atd registers mc68hc912dt128a rev 2.0 motorola analog-to-digital converter (atd) 313 atd registers control and data registers for the atd modules are described below. both atds have identical control registers mapped in two blocks of 16 bytes. writes to this register will abort current conversion sequence. read or write any time. write: write to this register has no meaning. read: special mode only. writes to these registers abort any current conversion sequence. read or write anytime except ascif bit, which cannot be written. adpu ? atd disable 0 = disables the atd, including the analog section for reduction in power consumption. 1 = allows the atd to function normally. atd0ctl0/atd1ctl0 ? reserved $0060/$01e0 bit 7654321bit 0 reset: 00000000 atd0ctl1/atd1ctl1 ? reserved $0061/$01e1 bit 7654321bit 0 reset: 0 0000000 atd0ctl2/atd1ctl2 ? atd control register 2 $0062/$01e2 bit 7654321bit 0 adpu affc aswai djm dsgn reserved ascie ascif reset: 0 0000000 3-atd
analog-to-digital converter (atd) mc68hc912dt128a rev 2.0 314 analog-to-digital converter (atd) motorola software can disable the clock signal to the a/d converter and power down the analog circuits to reduce power consumption. when reset to zero, the adpu bit aborts any conversion sequence in progress. because the bias currents to the analog circuits are turned off, the atd requires a period of recovery time to stabilize the analog circuits after setting the adpu bit. affc ? atd fast flag clear all 0 = atd flag clearing operates normally (read the status register before reading the result register to clear the associated ccf bit). 1 = changes all atd conversion complete flags to a fast clear sequence. any access to a result register (atd0 ? 7) will cause the associated ccf flag to clear automatically if it was set at the time. aswai ? atd stops in wait mode 0 = atd continues to run when the mcu is in wait mode 1 = atd stops to save power when the mcu is in wait mode when the aswai bit is set and the module enters wait mode, most of the clocks stop and the analog portion powers down. when the module comes out of wait, it is recommended that a stabilization delay (stop and atd power up recovery time, t sr ) is allowed before new conversions are started. additionally, the atd does not re-initialize automatically on leaving wait mode. djm ? result register data justification mode 0 = left justified 1 = right justified for 10-bit resolution, left justified mode maps a result register into data bus bits 6 through 15; bit 15 is the msb. in right justified mode, the result registers maps onto data bus bits 0 through 9; bit 9 is the msb. for 8-bit resolution, left justified mode maps a result into the high byte (bits 8 though 15; bit 15 is the msb). right justified maps a result into the low byte (bits 0 through 7; bit 7 is the msb). 4-atd
analog-to-digital converter (atd) atd registers mc68hc912dt128a rev 2.0 motorola analog-to-digital converter (atd) 315 dsgn ? signed/unsigned result data mode 0 = unsigned result register data 1 = signed result register data note that signed data is not available for right justified data. therefore, sign extension hardware is not required. table 47 summarizes the result data formats available and how they are set up using the control bits. table 48 illustrates the difference between the signed and unsigned, left justified output codes for an input signal range between 0 and 5.1 volts. ascie ? atd sequence complete interrupt enable 0 = disables atd interrupt 1 = enables atd interrupt on sequence complete sres10 djm dsgn result data formats description and bus bit mapping 0 0 0 1 1 1 0 0 1 0 0 1 0 1 x 0 1 x 8-bit/left justified/unsign - bits 8-15 8-bit/ left justified/signed - bits 8-15 8-bit/right justified/unsign - bits 0-7 10-bit/left justified/unsign - bits 6-15 10-bit/left justified/signed - bits 6-15 10-bit/right justified/unsign - bits 0-9 table 47 result data formats available. input signal vrl = 0 volts vrh = 5.12 volts signed 8-bit codes unsigned 8-bit codes signed 10-bit codes unsigned 10-bit codes 5.120 volts 5.100 5.080 2.580 2.560 2.540 0.020 0.000 7f 7f 7e 01 00 ff 81 80 ff ff fe 81 80 7f 01 00 7fc0 7f00 7e00 0100 0000 ff00 8100 8000 ffc0 ff00 fe00 8100 8000 7f00 0100 0000 table 48 left justified, signed and unsigned atd output codes. 5-atd
analog-to-digital converter (atd) mc68hc912dt128a rev 2.0 316 analog-to-digital converter (atd) motorola ascif ? atd sequence complete interrupt flag cannot be written in any mode. 0 = no atd interrupt occurred 1 = atd sequence complete read or write any time. s1c ? conversion sequence length (least significant bit) this control bit works with control bit s8c in atdctl5 in determining how many conversion are performed per sequence. when the s1c bit is set, a sequence length of 1 is defined. however, if the s8c bit is also set, the s8c bit takes precedence. for sequence length coding information see the description for s8c bit in atdctl5. fifo ? result register fifo mode 0 = result registers do not map to the conversion sequence 1 = result registers map to the conversion sequence in normal operation, the a/d conversion results map into the result registers based on the conversion sequence; the result of the first conversion appears in the first result register, the second result in the second result register, and so on. in fifo mode the result register counter is not reset at the beginning or ending of a conversion sequence; conversion results are placed in consecutive result registers between sequences. the result register counter wraps around when it reaches the end of the result register file. the conversion counter value in atdstat0 can be used to determine where in the result register file, the next conversion result will be placed. the results register counter is initialized to zero on three events: on reset, the beginning of a normal (non-fifo) conversion sequence, and the end of a normal (non-fifo) conversion sequence. therefore, the reset bit in register atdtest1 can be toggled to zero the result register counter; any sequence allowed to complete normally will zero atd0ctl3/atd1ctl3 ? atd control register 3 $0063/$01e3 bit 7654321bit 0 0 0 0 0 s1c fifo frz1 frz0 reset: 0 0000000 6-atd
analog-to-digital converter (atd) atd registers mc68hc912dt128a rev 2.0 motorola analog-to-digital converter (atd) 317 7-atd the result register counter; a new sequence (non-fifo) initiated with a write to atdctl4/5 followed by a write to atdctl3 to set the fifo bit will start a fifo sequence with the result register initialized. finally, which result registers hold valid data can be tracked using the conversion complete flags. fast flag clear mode may or may not be useful in a particular application to track valid data. frz1, frz0 ? background debug (freeze) enable (suspend module operation at breakpoint) when debugging an application, it is useful in many cases to have the atd pause when a breakpoint is encountered. these two bits determine how the atd will respond when background debug mode becomes active. the atd control register 4 is used to select the clock source and set up the prescaler. writes to the atd control registers initiate a new conversion sequence. if a write occurs while a conversion is in progress, the conversion is aborted and atd activity halts until a write to atdctl5 occurs. res10 ? 10 bit mode 0 = 8 bit operation 1 = 1= 10 bit operation smp1, smp0 ? select sample time used to select one of four sample times after the buffered sample and transfer has occurred. table 49 atd response to background debug enable frz1 frz0 atd response 0 0 continue conversions in active background mode 01 reserved 1 0 finish current conversion, then freeze 1 1 freeze when bdm is active atd0ctl4/atd1ctl4 ? atd control register 4 $0064/$01e4 bit 7654321bit 0 res10 smp1 smp0 prs4 prs3 prs2 prs1 prs0 reset: 0 0 0 0 0 0 0 1
analog-to-digital converter (atd) mc68hc912dt128a rev 2.0 318 analog-to-digital converter (atd) motorola prs4, prs3, prs2, prs1, prs0 ? select divide-by factor for atd p-clock prescaler. the binary value written to these bits (1 to 31) selects the divide-by factor for the modulo counter-based prescaler. the p clock is divided by this value plus one and then fed into a 2 circuit to generate the atd module clock. the divide-by-two circuit insures symmetry of the output clock signal. clearing these bits causes the prescale value default to one which results in a 2 prescale factor. this signal is then fed into the 2 logic. the reset state divides the p clock by a total of four and is appropriate for nominal operation at 2 mhz. table 51 shows the divide-by operation and the appropriate range of system clock frequencies. table 50 final sample time selection smp1 smp0 final sample time 0 0 2 a/d clock periods 0 1 4 a/d clock periods 1 0 8 a/d clock periods 1 1 16 a/d clock periods table 51 clock prescaler values prescale value total divisor max p clock (1) 1. maximum conversion frequency is 2 mhz. maximum p clock divisor value will become maximum conversion rate that can be used on this atd module. min p clock (2) 2. minimum conversion frequency is 500 khz. minimum p clock divisor value will become minimum conversion rate that this atd can perform. 00000 24 mhz 1 mhz 00001 48 mhz 2 mhz 00010 68 mhz 3 mhz 00011 88 mhz 4 mhz 00100 10 8 mhz 5 mhz 00101 12 8 mhz 6 mhz 00110 14 8 mhz 7 mhz 00111 16 8 mhz 8 mhz 01xxx do not use 1xxxx 8-atd
analog-to-digital converter (atd) atd registers mc68hc912dt128a rev 2.0 motorola analog-to-digital converter (atd) 319 9-atd the atd control register 5 is used to select the conversion modes, the conversion channel(s), and initiate conversions. read or write any time. writes to the atd control registers initiate a new conversion sequence. if a conversion sequence is in progress when a write occurs, that sequence is aborted and the scf and ccf bits are reset. s8c ? conversion sequence length (most significant bit) the s8c/s1c bits define the length of a conversion sequence. table 52 lists the coding combinations implemented. the result register assignments made to a conversion sequence follow a few simple rules. normally, the first result is placed in the first register; the second result is placed in the second register, and so on. table 53 presents the result register assignments for the various conversion lengths that are normally made. if fifo mode is used, the result register assignments differ. the results are placed in consecutive registers between conversion sequences; the result register mapping wraps around when the end of the register file is reached. atd0ctl5/atd1ctl5 ? atd control register 5 $0065/$01e5 bit 7654321bit 0 0 s8cm scan mult cd cc cb ca reset: 0 0 0 0 0 0 0 0 s8c s1c number of conversions per sequence 00 4 01 1 1x 8 table 52 conversion sequence length coding.
analog-to-digital converter (atd) mc68hc912dt128a rev 2.0 320 analog-to-digital converter (atd) motorola scan ? enable continuous channel scan 0 = single conversion sequence 1 = continuous conversion sequences (scan mode) when a conversion sequence is initiated by a write to the atdctl register, the user has a choice of performing a sequence of four (or eight, depending on the s8c bit) conversions or continuously performing four (or eight) conversion sequences. mult ? enable multichannel conversion 0 = atd sequencer runs all four or eight conversions on a single input channel selected via the cd, cc, cb, and ca bits. 1 = atd sequencer runs each of the four or eight conversions on sequential channels in a specific group. refer to table 54 . number of conversions per sequence result register assignment 1adr0 4 adr0 through adr3 8 adr0 through adr7 table 53 result register assignment for different conversion sequences. 10-atd
analog-to-digital converter (atd) atd registers mc68hc912dt128a rev 2.0 motorola analog-to-digital converter (atd) 321 11-atd cd, cc, cb, and ca ? channel select for conversion table 54 multichannel mode result register assignment s8cm cd cc cb ca channel signal result in adrxx if mult = 1 000 0 0 an0 adrx0 0 1 an1 adrx1 1 0 an2 adrx2 1 1 an3 adrx3 001 0 0 an4 adrx0 0 1 an5 adrx1 1 0 an6 adrx2 1 1 an7 adrx3 010 0 0 reserved adrx0 0 1 reserved adrx1 1 0 reserved adrx2 1 1 reserved adrx3 011 0 0v rh adrx0 0 1v rl adrx1 1 0(v rh + v rl )/2 adrx2 1 1 test/reserved adrx3 10 0 0 0 an0 adrx0 0 1 an1 adrx1 1 0 an2 adrx2 1 1 an3 adrx3 1 0 0 an4 adrx4 0 1 an5 adrx5 1 0 an6 adrx6 1 1 an7 adrx7 11 0 0 0 reserved adrx0 0 1 reserved adrx1 1 0 reserved adrx2 1 1 reserved adrx3 1 0 0v rh adrx4 0 1v rl adrx5 1 0(v rh + v rl )/2 adrx6 1 1 test/reserved adrx7 shaded bits are ? don ? t care ? if mult = 1 and the entire block of four or eight channels make up a conversion sequence. when mult = 0, all four bits (cd, cc, cb, and ca) must be specified and a conversion sequence consists of four or eight consecutive conversions of the single spec- ified channel.
analog-to-digital converter (atd) mc68hc912dt128a rev 2.0 322 analog-to-digital converter (atd) motorola the atd status registers contain the flags indicating the completion of atd conversions. normally, it is read-only. in special mode, the scf bit and the ccf bits may also be written. scf ? sequence complete flag this bit is set at the end of the conversion sequence when in the single conversion sequence mode (scan = 0 in atdctl5) and is set at the end of the first conversion sequence when in the continuous conversion mode (scan = 1 in atdctl5). when affc = 0, scf is cleared when a write is performed to atdctl5 to initiate a new conversion sequence. when affc = 1, scf is cleared after the first result register is read. cc[2:0] ? conversion counter for current sequence of four or eight conversions this 3-bit value reflects the contents of the conversion counter pointer in a four or eight count sequence. this value also reflects which result register will be written next, indicating which channel is currently being converted. ccf[7:0] ? conversion complete flags each of these bits are associated with an individual atd result register. for each register, this bit is set at the end of conversion for the associated atd channel and remains set until that atd result register is read. it is cleared at that time if affc bit is set, regardless of whether a status register read has been performed (i.e., a status atd0stat0/atd1stat0 ? atd status register $0066/$01e6 bit 7654321bit 0 scf 0 0 0 0 cc2 cc1 cc0 reset: 0 0 0 00000 atd0stat1/atd1stat1 ? atd status register $0067/$01e7 bit 7654321bit 0 ccf7 ccf6 ccf5 ccf4 ccf3 ccf2 ccf1 ccf0 reset: 0 0000000 12-atd
analog-to-digital converter (atd) atd registers mc68hc912dt128a rev 2.0 motorola analog-to-digital converter (atd) 323 13-atd register read is not a pre-qualifier for the clearing mechanism when affc = 1). otherwise the status register must be read to clear the flag. the test registers control various special modes which are used during manufacturing. the test register can be read or written only in the special modes. in the normal modes, reads of the test register return zero and writes have no effect. sar[9:0] ? sar data reads of this byte return the current value in the sar. writes to this byte change the sar to the value written. bits sar[9:0] reflect the ten sar bits used during the resolution process for a 10-bit result. rst ? module reset bit when set, this bit causes all registers and activity in the module to assume the same state as out of power-on reset (except for adpu bit in atdctl2, which remains set, allowing the atd module to remain enabled). atd0testh/atd1testh ? atd test register $0068/$01e8 bit 7654321bit 0 sar9 sar8 sar7 sar6 sar5 sar4 sar3 sar2 reset: 0 0000000 atd0testl/atd1testl ? atd test register $0069/$01e9 bit 7654321bit 0 sar1sar0rst00000 reset: 0 0 0 00000
analog-to-digital converter (atd) mc68hc912dt128a rev 2.0 324 analog-to-digital converter (atd) motorola padx[7:0] ? port ad data input bits after reset these bits reflect the state of the input pins. may be used for general-purpose digital input. when the software reads portad, it obtains the digital levels that appear on the corresponding port ad pins. pins with signals not meeting v il or v ih specifications will have an indeterminate value. writes to this register have no meaning at any time. adrxxh[15:8], adrxxl[7:0] ? atd conversion result the reset condition for these registers is undefined. these bits contain the left justified, unsigned result from the atd conversion. the channel from which this result was obtained is dependent on the conversion mode selected. these registers are always read-only in normal mode. portad0/portad1 ? port ad data input register $006f/$01ef bit 7654321bit 0 padx7 padx6 padx5 padx4 padx3 padx2 padx1 padx0 reset: -------- adrx0h ? a/d converter result register 0 $0070/$01f0 adrx0l ? a/d converter result register 0 $0071/$01f1 adrx1h ? a/d converter result register 1 $0072/$01f2 adrx1l ? a/d converter result register 1 $0073/$01f3 adrx2h ? a/d converter result register 2 $0074/$01f4 adrx2l ? a/d converter result register 2 $0075/$01f5 adrx3h ? a/d converter result register 3 $0076/$01f6 adrx3l ? a/d converter result register 3 $0077/$01f7 adrx4h ? a/d converter result register 4 $0078/$01f8 adrx4l ? a/d converter result register 4 $0079/$01f9 adrx5h ? a/d converter result register 5 $007a/$01fa adrx5l ? a/d converter result register 5 $007b/$01fb adrx6h ? a/d converter result register 6 $007c/$01fc adrx6l ? a/d converter result register 6 $007d/$01fd adrx7h ? a/d converter result register 7 $007e/$01fe adrx7l ? a/d converter result register 7 $007f/$01ff adrxxh bit 15654321bit 8 adrxxl bit 7bit 6000000 reset: 00000000 14-atd
analog-to-digital converter (atd) atd mode operation mc68hc912dt128a rev 2.0 motorola analog-to-digital converter (atd) 325 15-atd atd mode operation stop ? causes all clocks to halt (if the s bit in the ccr is zero). the system is placed in a minimum-power standby mode. this aborts any conversion sequence in progress. wait ? atd conversion continues unless awai bit in atdctl2 register is set. bdm ? debug options available as set in register atdctl3. user ? atd continues running unless adpu is cleared. adpu ? atd operations are stopped if adpu = 0, but registers are accessible.
analog-to-digital converter (atd) mc68hc912dt128a rev 2.0 326 analog-to-digital converter (atd) motorola 16-atd
mc68hc912dt128a rev 2.0 motorola development support 327 development support development support contents introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327 instruction queue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327 background debug mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329 breakpoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343 instruction tagging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350 introduction development support involves complex interactions between mc68hc912dt128a resources and external development systems. the following section concerns instruction queue and queue tracking signals, background debug mode, and instruction tagging. instruction queue the cpu12 instruction queue provides at least three bytes of program information to the cpu when instruction execution begins. the cpu12 always completely finishes executing an instruction before beginning to execute the next instruction. status signals ipipe[1:0] provide information about data movement in the queue and indicate when the cpu begins to execute instructions. this makes it possible to monitor cpu activity on a cycle-by-cycle basis for debugging. information available on the ipipe[1:0] pins is time multiplexed. external circuitry can latch data movement information on rising edges of the e-clock signal; execution start information can be latched on falling edges. table 55 shows the meaning of data on the pins. 1-dev
development support mc68hc912dt128a rev 2.0 328 development support motorola program information is fetched a few cycles before it is used by the cpu. in order to monitor cycle-by-cycle cpu activity, it is necessary to externally reconstruct what is happening in the instruction queue. internally the mcu only needs to buffer the data from program fetches. for system debug it is necessary to keep the data and its associated address in the reconstructed instruction queue. the raw signals required for reconstruction of the queue are addr, data, r/w , eclk, and status signals ipipe[1:0]. the instruction queue consists of two 16-bit queue stages and a holding latch on the input of the first stage. to advance the queue means to move the word in the first stage to the second stage and move the word from either the holding latch or the data bus input buffer into the first stage. to start even (or odd) instruction means to execute the opcode in the high-order (or low-order) byte of the second stage of the instruction queue. table 55 ipipe decoding data movement ? ipipe[1:0] captured at rising edge of e clock (1) 1. refers to data that was on the bus at the previous e falling edge. ipipe[1:0] mnemonic meaning 0:0 ? no movement 0:1 lat latch data from bus 1:0 ald advance queue and load from bus 1:1 all advance queue and load from latch execution start ? ipipe[1:0] captured at falling edge of e clock (2) 2. refers to bus cycle starting at this e falling edge. ipipe[1:0] mnemonic meaning 0:0 ? no start 0:1 int start interrupt sequence 1:0 sev start even instruction 1:1 sod start odd instruction 2--dev
development support background debug mode mc68hc912dt128a rev 2.0 motorola development support 329 background debug mode background debug mode (bdm) is used for system development, in-circuit testing, field testing, and programming. bdm is implemented in on-chip hardware and provides a full set of debug options. because bdm control logic does not reside in the cpu, bdm hardware commands can be executed while the cpu is operating normally. the control logic generally uses cpu dead cycles to execute these commands, but can steal cycles from the cpu when necessary. other bdm commands are firmware based, and require the cpu to be in active background mode for execution. while bdm is active, the cpu executes a firmware program located in a small on-chip rom that is available in the standard 64-kbyte memory map only while bdm is active. the bdm control logic communicates with an external host development system serially, via the bkgd pin. this single-wire approach minimizes the number of pins needed for development support. enabling bdm firmware commands bdm is available in all operating modes, but must be made active before firmware commands can be executed. bdm is enabled by setting the enbdm bit in the bdm status register via the single wire interface (using a hardware command; write_bd_byte at $ff01). bdm must then be activated to map bdm registers and rom to addresses $ff00 to $ffff and to put the mcu in active background mode. after the firmware is enabled, bdm can be activated by the hardware background command, by the bdm tagging mechanism, or by the cpu bgnd instruction. an attempt to activate bdm before firmware has been enabled causes the mcu to resume normal instruction execution after a brief delay. bdm becomes active at the next instruction boundary following execution of the bdm background command, but tags activate bdm before a tagged instruction is executed. 3-dev
development support mc68hc912dt128a rev 2.0 330 development support motorola in special single-chip mode, background operation is enabled and active immediately out of reset. this active case replaces the m68hc11 boot function, and allows programming a system with blank memory. while bdm is active, a set of bdm control registers are mapped to addresses $ff00 to $ff06. the bdm control logic uses these registers which can be read anytime by bdm logic, not user programs. refer to bdm registers for detailed descriptions. some on-chip peripherals have a bdm control bit which allows suspending the peripheral function during bdm. for example, if the timer control is enabled, the timer counter is stopped while in bdm. once normal program flow is continued, the timer counter is re-enabled to simulate real-time operations. bdm serial interface the bdm serial interface requires the external controller to generate a falling edge on the bkgd pin to indicate the start of each bit time. the external controller provides this falling edge whether data is transmitted or received. bkgd is a pseudo-open-drain pin that can be driven either by an external controller or by the mcu. data is transferred msb first at 16 bclk cycles per bit (nominal speed). the interface times out if 512 bclk cycles occur between falling edges from the host. the hardware clears the command register when a time-out occurs. the bkgd pin can receive a high or low level or transmit a high or low level. the following diagrams show timing for each of these cases. interface timing is synchronous to mcu clocks but asynchronous to the external host. the internal clock signal is shown for reference in counting cycles. figure 59 shows an external host transmitting a logic one or zero to the bkgd pin of a target mc68hc912dt128a mcu. the host is asynchronous to the target so there is a 0-to-1 cycle delay from the host-generated falling edge to where the target perceives the beginning of the bit time. ten target b cycles later, the target senses the bit level on the bkgd pin. typically the host actively drives the pseudo-open-drain bkgd pin during host-to-target transmissions to 4-dev
development support background debug mode mc68hc912dt128a rev 2.0 motorola development support 331 speed up rising edges. since the target does not drive the bkgd pin during this period, there is no need to treat the line as an open-drain signal during host-to-target transmissions. figure 59 bdm host to target serial bit timing figure 60 bdm target to host serial bit timing (logic 1) 10 cycles bclk (target mcu) host transmit 1 target senses bit earliest start of next bit synchronization uncertainty perceived start of bit time host transmit 0 hc12a4 bdm host to target tim 10 cycles bclk (target mcu) earliest start of next bit bkgd pin perceived start of bit time 10 cycles host samples bkgd pin host drive to bkgd pin target mcu speedup pulse r-c rise high-impedance high-impedance high-impedance hc12a4 bdm target to host tim 1 5-dev
development support mc68hc912dt128a rev 2.0 332 development support motorola figure 60 shows the host receiving a logic one from the target mc68hc912dt128a mcu. since the host is asynchronous to the target mcu, there is a 0-to-1 cycle delay from the host-generated falling edge on bkgd to the perceived start of the bit time in the target mcu. the host holds the bkgd pin low long enough for the target to recognize it (at least two target b cycles). the host must release the low drive before the target mcu drives a brief active-high speed-up pulse seven cycles after the perceived start of the bit time. the host should sample the bit level about ten cycles after it started the bit time. figure 61 bdm target to host serial bit timing (logic 0) figure 61 shows the host receiving a logic zero from the target mc68hc912dt128a mcu. since the host is asynchronous to the target mcu, there is a 0-to-1 cycle delay from the host-generated falling edge on bkgd to the start of the bit time as perceived by the target mcu. the host initiates the bit time but the target mc68hc912dt128a finishes it. since the target wants the host to receive a logic zero, it drives the bkgd pin low for 13 bclk cycles, then briefly drives it high to speed up the rising edge. the host samples the bit level about ten cycles after starting the bit time. 10 cycles bclk (target mcu) earliest start of next bit bkgd pin perceived start of bit time 10 cycles host samples bkgd pin host drive to bkgd pin target mcu drive and speedup pulse high-impedance speedup pulse hc12a4 bdm target to host tim 0 6-dev
development support background debug mode mc68hc912dt128a rev 2.0 motorola development support 333 7-dev bdm commands the bdm command set consists of two types: hardware and firmware. hardware commands allow target system memory to be read or written.target system memory includes all memory that is accessible by the cpu12 including eeprom, on-chip i/o and control registers, and external memory that is connected to the target hc12 mcu.hardware commands are implemented in hardware logic and do not require the hc12 mcu to be in bdm mode for execution.the control logic watches the cpu12 buses to find a free bus cycle to execute the command so the background access does not disturb the running application programs. if a free cycle is not found within 128 bclk cycles, the cpu12 is momentarily frozen so the control logic can steal a cycle.commands implemented in bdm control logic are listed in table 56 . table 56 hardware commands (1) command opcode (hex) data description background 90 none enter background mode if firmware enabled. read_bd_byte (1) e4 16-bit address 16-bit data out read from memory with bdm in map (may steal cycles if external access) data for odd address on low byte, data for even address on high byte. read_bd_word (1) ec 16-bit address 16-bit data out read from memory with bdm in map (may steal cycles if external access). must be aligned access. read_byte e0 16-bit address 16-bit data out read from memory with bdm out of map (may steal cycles if external access) data for odd address on low byte, data for even address on high byte. read_word e8 16-bit address 16-bit data out read from memory with bdm out of map (may steal cycles if external access). must be aligned access. write_bd_byte (1) c4 16-bit address 16-bit data in write to memory with bdm in map (may steal cycles if external access) data for odd address on low byte, data for even address on high byte. write_bd_word (1) cc 16-bit address 16-bit data in write to memory with bdm in map (may steal cycles if external access). must be aligned access. write_byte c0 16-bit address 16-bit data in write to memory with bdm out of map (may steal cycles if external access) data for odd address on low byte, data for even address on high byte. write_word c8 16-bit address 16-bit data in write to memory with bdm out of map (may steal cycles if external access). must be aligned access. 1. use these commands only for reading/writing to bdm locations . the bdm firmware rom and bdm registers are not nor- mally in the hc12 mcu memory map . since these locations have the same addresses as some of the normal application memory map, there needs to be a way to decide which physical locations are being accessed by the hardware bdm com- mands . this gives rise to needing separate memory access commands for the bdm locations as opposed to the normal application locations . in logic, this is accomplished by momentarily enabling the bdm memory resources, just for the ac- cess cycles of the read_bd and write_bd commands . this logic allows the debugging system to unobtrusively access the bdm locations even if the application program is running out of the same memory area in the normal application mem- ory map .
development support mc68hc912dt128a rev 2.0 334 development support motorola the second type of bdm commands are called firmware commands implemented in a small rom within the hc12 mcu.the cpu must be in background mode to execute firmware commands. the usual way to get to background mode is by the hardware command background. the bdm rom is located at $ff20 to $ffff while bdm is active. there are also seven bytes of bdm registers located at $ff00 to $ff06 while bdm is active. the cpu executes code in the bdm firmware to perform the requested operation. the bdm firmware watches for serial commands and executes them as they are received. the firmware commands are shown in ta b l e 5 7 . each of the hardware and firmware bdm commands start with an 8-bit command code (opcode). depending upon the commands, a 16-bit address and/or a 16-bit data word is required as indicated in the tables by the command. all the read commands output 16-bits of data despite the byte/word implication in the command name. the external host should wait 150 bclk cycles for a non-intrusive bdm command to execute before another command is sent. this delay includes 128 bclk cycles for the maximum delay for a free cycle.for data read commands, the host must insert this delay between sending table 57 bdm firmware commands command opcode (hex) data description read_next 62 16-bit data out x = x + 2; read next word pointed to by x read_pc 63 16-bit data out read program counter read_d 64 16-bit data out read d accumulator read_x 65 16-bit data out read x index register read_y 66 16-bit data out read y index register read_sp 67 16-bit data out read stack pointer write_next 42 16-bit data in x = x + 2; write next word pointed to by x write_pc 43 16-bit data in write program counter write_d 44 16-bit data in write d accumulator write_x 45 16-bit data in write x index register write_y 46 16-bit data in write y index register write_sp 47 16-bit data in write stack pointer go 08 none go to user program trace1 10 none execute one user instruction then return to bdm taggo 18 none enable tagging and go to user program 8-dev
development support background debug mode mc68hc912dt128a rev 2.0 motorola development support 335 9-dev the address and attempting to read the data.in the case of a write command, the host must delay after the data portion, before sending a new command, to be sure the write has finished. the external host should delay about 32 target bclk cycles between a firmware read command and the data portion of these commands. this allows the bdm firmware to execute the instructions needed to get the requested data into the bdm shifter register. the external host should delay about 32 target bclk cycles after the data portion of firmware write commands to allow bdm firmware to complete the requested write operation before a new serial command disturbs the bdm shifter register. the external host should delay about 64 target bclk cycles after a trace1 or go command before starting any new serial command. this delay is needed because the bdm shifter register is used as a temporary data holding register during the exit sequence to user code. bdm logic retains control of the internal buses until a read or write is completed.if an operation can be completed in a single cycle, it does not intrude on normal cpu12 operation.however, if an operation requires multiple cycles, cpu12 clocks are frozen until the operation is complete. bdm lockout the access to the mcu resources by bdm may be prevented by enabling the bdm lockout feature. when enabled, the bdm lockout mechanism prevents the bdm from being active. in this case the bdm rom is disabled and does not appear in the mcu memory map. the bdm lockout is enabled by clearing nobdml bit of eemcr register. the nobdml bit is loaded at reset from the shadow word of eeprom module. modifying the state of the nobdml and corresponding eeprom shadow bit is only possible in special modes. please refer to eeprom for nobdml information.
development support mc68hc912dt128a rev 2.0 336 development support motorola enabling the bdm lockout enabling the bdm lockout feature is only possible in special modes (smodn=0) and is accomplished by the following steps. 1. remove the shadow word protection by clearing shprot bit in eeprot register. 2. clear noshw bit in eemcr register to make the shadow word visible at $0fc0-$0fc1. 3. program bit 7 of the high byte of the shadow word like a regular eeprom location at address $0fc0 (write $7f into address $0fc0). do not program other bits of the high byte of the shadow word (location $0fc0); otherwise some regular eeprom array locations will not be visible. at the next reset, the high byte of the shadow word is loaded into the eemcr register. nobdml bit in eemcr will be cleared and bdm will not be operational. 4. protect the shadow word by setting shprot bit in eeprot register. disabling the bdm lockout disabling the bdm lockout is only possible in special modes (smodn=0) except in special single chip. follow the same steps as for enabling the bdm lockout, but erase the shadow word. at the next reset, the high byte of shadow word is loaded into the eemcr register. nobdml bit in eemcr will be set and bdm becomes operational. note: when the bdm lockout is enabled it is not possible to run code from the reset vector in special single chip mode. bdm registers seven bdm registers are mapped into the standard 64-kbyte address space when bdm is active. mapping is shown in table 58 . table 58 bdm registers address register $ff00 bdm instruction register $ff01 bdm status register 10-dev
development support background debug mode mc68hc912dt128a rev 2.0 motorola development support 337 11-dev the content of the instruction register is determined by the type of background command being executed.the status register indicates bdm operating conditions.the shift register contains data being received or transmitted via the serial interface. the address register is temporary storage for bdm commands.the ccrsav register preserves the content of the cpu12 ccr while bdm is active. the only registers of interest to users are the status register and the ccrsav register.the other bdm registers are only used by the bdm firmware to execute commands.the registers are accessed by means of the hardware read_bd and write_bd commands, but should not be written during bdm operation (except the ccrsav register which could be written to modify the ccr value). status the status register is read and written by the bdm hardware as a result of serial data shifted in on the bkgd pin. read: all modes. write: bits 3 through 5, and bit 7 are writable in all modes. bit 6, bdmact, can only be written if bit 7 h/f in the instruction register is a zero. bit 2, clksw, can only be written if bit 7 h/f in the instruction register is a one. a user would never write ones to bits 3 through 5 because these bits are only used by bdm firmware. $ff02 - $ff03 bdm shift register $ff04 - $ff05 bdm address register $ff06 bdm ccr holding register table 58 bdm registers address register status ? bdm status register (1) $ff01 bit 7654321bit 0 enbdm bdmact entag sdv trace clksw - - reset: 0 (note 1) 1000000 special single chip & periph reset: 0 0 0 0 0 0 0 0 all other modes
development support mc68hc912dt128a rev 2.0 338 development support motorola enbdm ? enable bdm (permit active background debug mode) 0 = bdm cannot be made active (hardware commands still allowed). 1 = bdm can be made active to allow firmware commands. bdmact ? background mode active status bdmact becomes set as active bdm mode is entered so that the bdm firmware rom is enabled and put into the map. bdmact is cleared by a carefully timed store instruction in the bdm firmware as part of the exit sequence to return to user code and remove the bdm memory from the map. this bit has 4 clock cycles write delay. 0 = bdm is not active. bdm rom and registers are not in map. 1 = bdm is active and waiting for serial commands. bdm rom and registers are in map the user should be careful that the state of the bdmact bit is not unintentionally changed with the write_next firmware command. if it is unintentionally changed from 1 to 0, it will cause a system runaway because it would disable the bdm firmware rom while the cpu12 was executing bdm firmware. the following two commands show how bdmact may unintentionally get changed from 1 to 0. write_x with data $fefe write_next with data $c400 the first command writes the data $fefe to the x index register. the second command writes the data $c4 to the $ff00 instruction register and also writes the data $00 to the $ff01 status register. entag ? tagging enable set by the taggo command and cleared when bdm mode is entered. the serial system is disabled and the tag function enabled 16 cycles after this bit is written. 0 = tagging not enabled, or bdm active. 1 = tagging active. bdm cannot process serial commands while tagging is active. 1. enbdm is set to 1 by the firmware in special single chip mode. 12-dev
development support background debug mode mc68hc912dt128a rev 2.0 motorola development support 339 13-dev sdv ? shifter data valid shows that valid data is in the serial interface shift register. used by the bdm firmware. 0 = no valid data. shift operation is not complete. 1 = valid data. shift operation is complete. trace ? asserted by the trace1 command clksw ? clock switch 0 = bdm system operates with bclk. 1 = bdm system operates with eclk. the write_bd_byte@ff01 command that changes clksw including 150 cycles after the data portion of the command should be timed at the old speed. beginning with the start of the next bdm command, the new clock can be used for timing bdm communications. if eclk rate is slower than bclk rate, clksw is ignored and bdm system is forced to operate with eclk. instruction - hardware instruction decode the instruction register is written by the bdm hardware as a result of serial data shifted in on the bkgd pin. it is readable and writable in special peripheral mode on the parallel bus. it is discussed here for two conditions: when a hardware command is executed and when a firmware command is executed. read and write: all modes . the hardware clears the instruction register if 512 bclk cycles occur between falling edges from the host. the bits in the bdm instruction register have the following meanings when a hardware command is executed. instruction ? bdm instruction register (hardware command explanation) $ff00 bit 7654321bit 0 h/f data r/w bkgnd w/b bd/u 0 0 reset: 0 0 0 0 0 0 0 0
development support mc68hc912dt128a rev 2.0 340 development support motorola h/f ? hardware/firmware flag 0 = firmware command 1 = hardware command data ? data flag - shows that data accompanies the command. 0 = no data 1 = data follows the command r/w ? read/write flag 0 = write 1 = read bkgnd ? hardware request to enter active background mode 0 = not a hardware background command 1 = hardware background command (instruction = $90) w/b ? word/byte transfer flag 0 = byte transfer 1 = word transfer bd/u ? bdm map/user map flag indicates whether bdm registers and rom are mapped to addresses $ff00 to $ffff in the standard 64-kbyte address space. used only by hardware read/write commands. 0 = bdm resources not in map 1 = bdm rom and registers in map the bits in the bdm instruction register have the following meanings when a firmware command is executed. h/f ? hardware/firmware flag 0 = firmware command 1 = hardware command data ? data flag ? shows that data accompanies the command. 0 = no data instruction ? bdm instruction register (firmware command bit explanation) $ff00 bit 7654321bit 0 h/f data r/w ttago regn 14-dev
development support background debug mode mc68hc912dt128a rev 2.0 motorola development support 341 15-dev 1 = data follows the command r/w ? read/write flag 0 = write 1 = read ttago ? trace, tag, go field regn ? register/next field indicates which register is being affected by a command. in the case of a read_next or write_next command, index register x is pre-incriminated by 2 and the word pointed to by x is then read or written. table 59 ttago decoding ttago value instruction 00 ? 01 go 10 trace1 11 taggo table 60 regn decoding regn value instruction 000 ? 001 ? 010 read/write next 011 pc 100 d 101 x 110 y 111 sp
development support mc68hc912dt128a rev 2.0 342 development support motorola shifter this 16-bit shift register contains data being received or transmitted via the serial interface. it is also used by the bdm firmware for temporary storage. read: all modes (but not normally accessed by users) write: all modes (but not normally accessed by users) address this 16-bit address register is temporary storage for bdm hardware and firmware commands. read: all modes (but not normally accessed by users) write: only by bdm hardware (state machine) shifter ? bdm shift register ? high byte $ff02 bit 15 14 13 12 11 10 9 bit 8 s15 s14 s13 s12 s11 s10 s9 s8 reset: xxxxxxxx shifter ? bdm shift register ? low byte $ff03 bit 7654321bit 0 s7 s6 s5 s4 s3 s2 s1 s0 reset: xxxxxxxx address ? bdm address register ? high byte $ff04 bit 15 14 13 12 11 10 9 bit 8 a15 a14 a13 a12 a11 a10 a9 a8 reset: xxxxxxxx address ? bdm address register ? high byte $ff05 bit 7654321bit 0 a7 a6 a5 a4 a3 a2 a1 a0 reset: xxxxxxxx 16-dev
development support breakpoints mc68hc912dt128a rev 2.0 motorola development support 343 17-dev ccrsav the ccrsav register is used to save the ccr of the users program when entering bdm. it is also used for temporary storage in the bdm firmware. read and write: all modes breakpoints hardware breakpoints are used to debug software on the mc68hc912dt128a by comparing actual address and data values to predetermined data in setup registers. a successful comparison will place the cpu in background debug mode (bdm) or initiate a software interrupt (swi). breakpoint features designed into the mc68hc912dt128a include:  mode selection for bdm or swi generation  program fetch tagging for cycle of execution breakpoint  second address compare in dual address modes  range compare by disable of low byte address  data compare in full feature mode for non-tagged breakpoint  byte masking for high/low byte data compares  r/w compare for non-tagged compares  tag inhibit on bdm trace ccrsav ? bdm ccr holding register $ff06 bit 7654321bit 0 ccr7 ccr6 ccr5 ccr4 ccr3 ccr2 ccr1 ccr0 reset: note 1 (1) xxxxxxxx 1. initialized to equal the cpu12 ccr register by the firmware.
development support mc68hc912dt128a rev 2.0 344 development support motorola breakpoint modes three modes of operation determine the type of breakpoint in effect.  dual address-only breakpoints, each of which will cause a software interrupt (swi)  single full-feature breakpoint which will cause the part to enter background debug mode (bdm)  dual address-only breakpoints, each of which will cause the part to enter bdm breakpoints will not occur when bdm is active. swi dual address mode in this mode, dual address-only breakpoints can be set, each of which cause a software interrupt. this is the only breakpoint mode which can force the cpu to execute a swi. program fetch tagging is the default in this mode; data breakpoints are not possible. in the dual mode each address breakpoint is affected by the bkpm bit and the bkale bit. the bkxrw and bkxrwe bits are ignored. in dual address mode the bkdbe becomes an enable for the second address breakpoint. the bksz8 bit will have no effect when in a dual address mode. bdm full breakpoint mode a single full feature breakpoint which causes the part to enter background debug mode. bdm mode may be entered by a breakpoint only if an internal signal from the bdm indicates background debug mode is enabled.  breakpoints are not allowed if the bdm mode is already active. active mode means the cpu is executing out of the bdm rom.  bdm should not be entered from a breakpoint unless the enable bit is set in the bdm. this is important because even if the enable bit in the bdm is negated the cpu actually does execute the bdm rom code. it checks the enable and returns if not set. if the bdm is not serviced by the monitor then the breakpoint would be re-asserted when the bdm returns to normal cpu flow.  there is no hardware to enforce restriction of breakpoint operation if the bdm is not enabled. 18-dev
development support breakpoints mc68hc912dt128a rev 2.0 motorola development support 345 19-dev bdm dual address mode dual address-only breakpoints, each of which cause the part to enter background debug mode. in the dual mode each address breakpoint is affected, consistent across modes, by the bkpm bit, the bkale bit, and the bkxrw and bkxrwe bits. in dual address mode the bkdbe becomes an enable for the second address breakpoint. the bksz8 bit will have no effect when in a dual address mode. bdm mode may be entered by a breakpoint only if an internal signal from the bdm indicates background debug mode is enabled.  bkdbe will be used as an enable for the second address only breakpoint.  breakpoints are not allowed if the bdm mode is already active. active mode means the cpu is executing out of the bdm rom.  bdm should not be entered from a breakpoint unless the enable bit is set in the bdm. this is important because even if the enable bit in the bdm is negated the cpu actually does execute the bdm rom code. it checks the enable and returns if not set. if the bdm is not serviced by the monitor then the breakpoint would be re-asserted when the bdm returns to normal cpu flow. there is no hardware to enforce restriction of breakpoint operation if the bdm is not enabled. breakpoint registers breakpoint operation consists of comparing data in the breakpoint address registers (brkah/brkal) to the address bus and comparing data in the breakpoint data registers (brkdh/brkdl) to the data bus. the breakpoint data registers can also be compared to the address bus. the scope of comparison can be expanded by ignoring the least significant byte of address or data matches. the scope of comparison can be limited to program data only by setting the bkpm bit in breakpoint control register 0. to trace program flow, setting the bkpm bit causes address comparison of program data only. control bits are also available that allow checking read/write matches.
development support mc68hc912dt128a rev 2.0 346 development support motorola read and write anytime. this register is used to control the breakpoint logic. bken1, bken0 ? breakpoint mode enable bkpm ? break on program addresses this bit controls whether the breakpoint will cause a break on a match (next instruction boundary) or on a match that will be an executable opcode. data and non-executed opcodes cannot cause a break if this bit is set. this bit has no meaning in swi dual address mode. the swi mode only performs program breakpoints. 0 = on match, break at the next instruction boundary 1 = on match, break if the match is an instruction that will be executed. this uses tagging as its breakpoint mechanism. bk1ale ? breakpoint 1 range control only valid in dual address mode. 0 = brkdl will not be used to compare to the address bus. 1 = brkdl will be used to compare to the address bus. bk0ale ? breakpoint 0 range control valid in all modes. 0 = brkal will not be used to compare to the address bus. brkct0 ? breakpoint control register 0 $0020 bit 7 6 5 4 3 2 1 bit 0 bken1 bken0 bkpm 0 bk1ale bk0ale 0 0 reset: 0 0 0 0 0 0 0 0 table 61 breakpoint mode control bken1 bken0 mode selected brkah/l usage brkdh/l usage r/w range 0 0 breakpoints off ???? 01swi ? dual address mode address match address match no yes 10bdm ? full breakpoint mode address match data match yes yes 11bdm ? dual address mode address match address match yes yes 20-dev
development support breakpoints mc68hc912dt128a rev 2.0 motorola development support 347 21-dev 1 = brkal will be used to compare to the address bus. this register is read/write in all modes. bkdbe ? enable data bus enables comparing of address or data bus values using the brkdh/ l registers. 0 = the brkdh/l registers are not used in any comparison 1 = the brkdh/l registers are used to compare address or data (depending upon the mode selections bken1,0) bkmbh ? breakpoint mask high disables the comparing of the high byte of data when in full breakpoint mode. used in conjunction with the bkdbe bit (which should be set) 0 = high byte of data bus (bits 15:8) are compared to brkdh 1 = high byte is not used to in comparisons bkmbl ? breakpoint mask low disables the matching of the low byte of data when in full breakpoint mode. used in conjunction with the bkdbe bit (which should be set) 0 = low byte of data bus (bits 7:0) are compared to brkdl 1 = low byte is not used to in comparisons. table 62 breakpoint address range control bk1ale bk0ale address range selected ? 0 upper 8-bit address only for full mode or dual mode bkp0 ? 1 full 16-bit address for full mode or dual mode bkp0 0 ? upper 8-bit address only for dual mode bkp1 1 ? full 16-bit address for dual mode bkp1 brkct1 ? breakpoint control register 1 $0021 bit 7 6 5 4 3 2 1 bit 0 0 bkdbe bkmbh bkmbl bk1rwe bk1rw bk0rwe bk0rw reset: 0 0 0 0 0 0 0 0
development support mc68hc912dt128a rev 2.0 348 development support motorola bk1rwe ? r/w compare enable enables the comparison of the r/w signal to further specify what causes a match. this bit is not useful in program breakpoints or in full breakpoint mode. this bit is used in conjunction with a second address in dual address mode when bkdbe=1. 0 = r/w is not used in comparisons 1 = r/w is used in comparisons bk1rw ? r/w compare value when bk1rwe = 1, this bit determines the type of bus cycle to match. 0 = a write cycle will be matched 1 = a read cycle will be matched bk0rwe ? r/w compare enable enables the comparison of the r/w signal to further specify what causes a match. this bit is not useful in program breakpoints. 0 = r/w is not used in the comparisons 1 = r/w is used in comparisons bk0rw ? r/w compare value when bk0rwe = 1, this bit determines the type of bus cycle to match on. 0 = write cycle will be matched 1 = read cycle will be matched table 63 breakpoint read/write control bk1rwe bk1rw bk0rwe bk0rw read/write selected ?? 0x r/w is don ? t care for full mode or dual mode bkp0 ?? 10r/w is write for full mode or dual mode bkp0 ?? 11r/w is read for full mode or dual mode bkp0 0x ?? r/w is don ? t care for dual mode bkp1 10 ?? r/w is write for dual mode bkp1 11 ?? r/w is read for dual mode bkp1 22-dev
development support breakpoints mc68hc912dt128a rev 2.0 motorola development support 349 23-dev these bits are used to compare against the most significant byte of the address bus. these bits are used to compare against the least significant byte of the address bus. these bits may be excluded from being used in the match if bk0ale = 0. these bits are compared to the most significant byte of the data bus or the most significant byte of the address bus in dual address modes. bken[1:0], bkdbe, and bkmbh control how this byte will be used in the breakpoint comparison. these bits are compared to the least significant byte of the data bus or the least significant byte of the address bus in dual address modes. brkah ? breakpoint address register, high byte $0022 bit 7 6 5 4 3 2 1 bit 0 bit 15 14 13 12 11 10 9 bit 8 reset: 0 0 0 0 0 0 0 0 brkal ? breakpoint address register, low byte $0023 bit 7 6 5 4 3 2 1 bit 0 bit 7 6 5 4 3 2 1 bit 0 reset: 0 0 0 0 0 0 0 0 brkdh ? breakpoint data register, high byte $0024 bit 7 6 5 4 3 2 1 bit 0 bit 15 14 13 12 11 10 9 bit 8 reset: 0 0 0 0 0 0 0 0 brkdl ? breakpoint data register, low byte $0025 bit 7 6 5 4 3 2 1 bit 0 bit 7 6 5 4 3 2 1 bit 0 reset: 0 0 0 0 0 0 0 0
development support mc68hc912dt128a rev 2.0 350 development support motorola bken[1:0], bkdbe, bk1ale, and bkmbl control how this byte will be used in the breakpoint comparison. instruction tagging the instruction queue and cycle-by-cycle cpu activity can be reconstructed in real time or from trace history that was captured by a logic analyzer. however, the reconstructed queue cannot be used to stop the cpu at a specific instruction, because execution has already begun by the time an operation is visible outside the mcu. a separate instruction tagging mechanism is provided for this purpose. executing the bdm taggo command configures two mcu pins for tagging. the taglo signal shares a pin with the lstrb signal, and the taghi signal shares a pin with the bkgd signal. tagging information is latched on the falling edge of eclk. table 64 shows the functions of the two tagging pins. the pins operate independently - the state of one pin does not affect the function of the other. the presence of logic level zero on either pin at the fall of eclk performs the indicated function. tagging is allowed in all modes. tagging is disabled when bdm becomes active and bdm serial commands are not processed while tagging is active. the tag follows program information as it advances through the queue. when a tagged instruction reaches the head of the queue, the cpu enters active background debugging mode rather than execute the instruction. table 64 tag pin function taghi taglo tag 1 1 no tag 10 low byte 0 1 high byte 0 0 both bytes 24-dev
mc68hc912dt128a rev 2.0 motorola electrical characteristics 351 electrical characteristics electrical characteristics contents introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352 tables of data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353 maximum ratings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353 thermal characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354 dc electrical characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354 supply current . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355 atd dc electrical characteristics . . . . . . . . . . . . . . . . . . . . . . . . 356 analog converter characteristics (operating) . . . . . . . . . . . . . . . 357 atd ac characteristics (operating). . . . . . . . . . . . . . . . . . . . . . . 358 atd maximum ratings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358 eeprom characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359 flash eeprom characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . 359 pulse width modulator characteristics . . . . . . . . . . . . . . . . . . . . . 360 control timing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361 peripheral port timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366 multiplexed expansion bus timing . . . . . . . . . . . . . . . . . . . . . . . . 367 spi timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369 cgm characteristics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372 stop key wake-up filter. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372 1-elec
electrical characteristics mc68hc912dt128a rev 2.0 352 electrical characteristics motorola introduction the mc68hc912dt128a microcontroller unit (mcu) is a16-bit device composed of standard on-chip peripherals including a 16-bit central processing unit (cpu12), 128-kbyte flash eeprom, 8k byte ram, 2k byte eeprom, two asynchronous serial communications interfaces (sci), a serial peripheral interface (spi), an 8-channel, 16-bit timer, two16-bit pulse accumulators and 16-bit down counter (ect), two 10-bit analog-to-digital converter (adc), a four-channel pulse-width modulator (pwm), an iic interface module, and three mscan modules. the chip is the first 16-bit microcontroller to include both byte-erasable eeprom and flash eeprom on the same device. system resource mapping, clock generation, interrupt control and bus interfacing are managed by the lite integration module (lim). the mc68hc912dt128a has full 16-bit data paths throughout, however, the multiplexed external bus can operate in an 8-bit narrow mode so single 8-bit wide memory can be interfaced for lower cost systems. 2--elec
electrical characteristics tables of data mc68hc912dt128a rev 2.0 motorola electrical characteristics 353 tables of data note: four pins (vrl0, vrh0, vrl1, and vrh1) show esd susceptibility below the motorola standards. care should be exercised in handling these pins. table 65 maximum ratings (1) 1. permanent damage can occur if maximum ratings are exceeded. exposures to voltages or currents in excess of recom- mended values affects device reliability. device modules may not operate normally while being exposed to electrical ex- tremes. rating symbol value unit supply voltage v dd , v dda , v ddx ? 0.3 to + 6.5 v input voltage v in ? 0.3 to + 6.5 v operating temperature range t a t l to t h 0 to + 70 ? 40 to + 85 c storage temperature range t stg ? 55 to + 150 c current drain per pin (2) excluding v dd and v ss 2. one pin at a time, observing maximum power dissipation limits. internal circuitry protects the inputs against damage caused by high static voltages or electric fields; however, normal precautions are necessary to avoid application of any voltage high- er than maximum-rated voltages to this high-impedance circuit. extended operation at the maximum ratings can adversely affect device reliability. tying unused inputs to an appropriate logic voltage level (either gnd or v dd ) enhances reliability of operation. i in 25 ma v dd differential voltage v dd ? v ddx 6.5 v 3-elec
electrical characteristics mc68hc912dt128a rev 2.0 354 electrical characteristics motorola table 66 thermal characteristics characteristic symbol value unit average junction temperature t j t a + (p d ja ) c ambient temperature t a user-determined c package thermal resistance (junction-to-ambient) 112-pin quad flat pack (qfp) ja 40 c/w total power dissipation (1) p d p int + p i/o or w device internal power dissipation p int i dd v dd w i/o pin power dissipation (2) p i/o user-determined w a constant (3) kp d (t a + 273 c) + ja p d 2 w c 1. this is an approximate value, neglecting p i/o . 2. for most applications p i/o ? p int and can be neglected. 3. k is a constant pertaining to the device. solve for k with a known t a and a measured p d (at equilibrium). use this value of k to solve for p d and t j iteratively for any value of t a . k t j 273 c + table 67 dc electrical characteristics v dd = 5.0 vdc 10%, v ss = 0 vdc, t a = t l to t h , unless otherwise noted characteristic symbol min max unit input high voltage, all inputs v ih 0.7 v dd v dd + 0.3 v input low voltage, all inputs v il v ss ? 0.3 0.2 v dd v output high voltage, all i/o and output pins except xtal normal drive strength i oh = ? 10.0 a i oh = ? 0.8 ma reduced drive strength i oh = ? 4.0 a i oh = ? 0.3 ma v oh v dd ? 0.2 v dd ? 0.8 v dd ? 0.2 v dd ? 0.8 ? ? ? ? v v v v output low voltage, all i/o and output pins except xtal normal drive strength i ol = 10.0 a i ol = 1.6 ma reduced drive strength i ol = 3.6 a i ol = 0.6 ma v ol ? ? ? ? v ss + 0.2 v ss + 0.4 v ss + 0.2 v ss + 0.4 v v v v 4-elec
electrical characteristics tables of data mc68hc912dt128a rev 2.0 motorola electrical characteristics 355 input leakage current (1) v in = v dd or v ss all input only pins except irq , atd (2) and v fp v in = v dd or v ss irq i in ? ? 2.5 10 a a three-state leakage, i/o ports, bkgd, and reset i oz ? 2.5 a input capacitance all input pins and atd pins (non-sampling) atd pins (sampling) all i/o pins c in ? ? ? 10 15 20 pf pf pf output load capacitance all outputs except ps[7:4] ps[7:4] when configured as spi c l ? ? 90 200 pf pf programmable active pull-up/pull-down current irq , xirq , dbe , lstrb , r/w . ports a, b, h, j, k, p, s, t moda, modb active pull down during reset bkgd passive pull up i apu 50 50 50 500 500 500 a a a ram standby voltage, power down v sb 1.5 ? v ram standby current i sb ? 50 a 1. specification is for parts in the -40 to +85 c range. higher temperature ranges will result in increased current leakage. 2. see atd dc electrical characteristics . table 67 dc electrical characteristics v dd = 5.0 vdc 10%, v ss = 0 vdc, t a = t l to t h , unless otherwise noted characteristic symbol min max unit table 68 supply current v dd = 5.0 vdc 10%, v ss = 0 vdc, t a = t l to t h , unless otherwise noted characteristic symbol 2 mhz 4 mhz 8 mhz unit maximum total supply current run: single-chip mode expanded mode i dd 20 30 30 50 55 90 ma ma wait: (all peripheral functions shut down) single-chip mode expanded mode w idd 3 4 5 6.5 10 15 ma ma stop: single-chip mode, no clocks s idd 150 150 150 a 5-elec
electrical characteristics mc68hc912dt128a rev 2.0 356 electrical characteristics motorola table 69 atd dc electrical characteristics v dd = 5.0 vdc 10%, v ss = 0 vdc, t a = t l to t h , atd clock = 2 mhz, unless otherwise noted characteristic symbol min max unit analog supply voltage v dda 4.5 5.5 v analog supply currentnormal operation stop i dda 1.0 10 ma a reference voltage, low v rl v ssa v dda / 2v reference voltage, high v rh v dda / 2v dda v v ref differential reference voltage (1) v rh ? v rl 4.5 5.5 v input voltage (2) v indc v ssa v dda v input current, off channel (3) i off 100 a reference supply current i ref 250 a input capacitancenot sampling sampling c inn c ins 10 15 pf pf 1. accuracy is guaranteed at v rh ? v rl = 5.0v 10%. 2. to obtain full-scale, full-range results, v ssa v rl v indc v rh v dda . 3. maximum leakage occurs at maximum operating temperature. current decreases by approximately one-half for each 10 c decrease from maximum temperature. 6-elec
electrical characteristics tables of data mc68hc912dt128a rev 2.0 motorola electrical characteristics 357 7-elec table 70 analog converter characteristics (operating) v dd = 5.0 vdc 10%, v ss = 0 vdc, t a = t l to t h , atd clock = 2 mhz, unless otherwise noted characteristic symbol min typical max unit 8-bit resolution (1) 1 count 20 mv 8-bit differential non-linearity (2) dnl ? 0.5 + 0.5 count 8-bit integral non-linearity (2) inl ? 1 + 1 count 8-bit absolute error ,(3) 2, 4, 8, and 16 atd sample clocks ae ? 1 + 1 count 10-bit resolution (1) 1 count 5 mv 10-bit differential non-linearity (2) dnl ? 2 2 count 10-bit integral non-linearity (2) inl ? 2 2 count 10-bit absolute error (3) 2, 4, 8, and 16 atd sample clocks ae ? 2.5 2.5 count maximum source impedance r s 20 see note (4) k ? 1. v rh ? v rl 5.12v; v dda ? v ssa = 5.12v 2. at v ref = 5.12v, one 8-bit count = 20 mv, and one 10-bit count = 5mv. inl and dnl are characterized using the process window parameters affecting the atd accuracy, but they are not tested. 3. these values include quantization error which is inherently 1/2 count for any a/d converter. 4. maximum source impedance is application-dependent. error resulting from pin leakage depends on junction leakage into the pin and on leakage due to charge-sharing with internal capacitance. error from junction leakage is a function of external source impedance and input leakage current. expected error in result value due to junction leakage is expressed in voltage (v errj ): v errj = r s i off where i off is a function of operating temperature. charge-sharing effects with internal capacitors are a function of atd clock speed, the number of channels being scanned, and source impedance. for 8-bit conversions, charge pump leakage is computed as follows: v errj = .25pf v dda r s atdclk/(8 number of channels)
electrical characteristics mc68hc912dt128a rev 2.0 358 electrical characteristics motorola table 71 atd ac characteristics (operating) v dd = 5.0 vdc 10%, v ss = 0 vdc, t a = t l to t h , atd clock = 2 mhz, unless otherwise noted characteristic symbol min max unit atd operating clock frequency f atdclk 0.5 2.0 mhz conversion time per channel 0.5 mhz f atdclk 2 mhz 16 atd clocks 30 atd clocks t conv 8.0 15.0 32.0 60.0 s s stop and atd power up recovery time (1) v dda = 5.0v t sr 10 s 1. from the time adpu is asserted until the time an atd conversion can begin. table 72 atd maximum ratings characteristic symbol value units atd reference voltage v rh v dda v rl v ssa v rh v rl ? 0.3 to + 6.5 ? 0.3 to + 6.5 v v v ss differential voltage | v ss ? v ssa | 0.1 v v dd differential voltage v dd ? v dda v dda ? v dd 6.5 0.3 v v v ref differential voltage | v rh ? v rl | 6.5 v reference to supply differential voltage | v rh ? v dda | 6.5 v 8-elec
electrical characteristics tables of data mc68hc912dt128a rev 2.0 motorola electrical characteristics 359 9-elec table 73 eeprom characteristics v dd = 5.0 vdc 10%, v ss = 0 vdc, t a = t l to t h , unless otherwise noted characteristic symbol min max unit minimum programming clock frequency f prog 250k hz programming time t prog 10 ms clock recovery time, following stop, to continue programming t crstop t prog + 1ms erase time t erase 10 ms write/erase endurance 10,000 cycles data retention 10 (1) years eeprom programming maximum time to ? auto ? bit set ?? 500 s eeprom erasing maximum time to ? auto ? bit set ?? 10 ms 1. based on the average life time operating temperature of 70 c. table 74 flash eeprom characteristics v dd = 5.0 vdc 10%, v ss = 0 vdc, t a = t l to t h , unless otherwise noted characteristic symbol min max units bytes per row ? 64 64 bytes read bus clock frequency f read 32k 8m hz erase time t eras 8 ? ms pgm/eras to hven set up time t nvs 10 ? s high-voltage hold time t nvh 5 ? s high-voltage hold time (erase) t nvhl 100 ? s program hold time t pgs 5 ? s program time t fpgm 30 40 s return to read time t rcv 1 ? s cumulative program hv period t hv ? 8ms row program/erase endurance ? 100 cycles data retention ? 10 (1) years 1. based on the average life time operating temperature of 70 c.
electrical characteristics mc68hc912dt128a rev 2.0 360 electrical characteristics motorola table 75 pulse width modulator characteristics v dd = 5.0 vdc 10%, v ss = 0 vdc, t a = t l to t h , unless otherwise noted characteristic symbol min max unit e-clock frequency f eclk 0.004 8.0 mhz a-clock frequency selectable f aclk f eclk /128 f eclk hz bclk frequency selectable f bclk f eclk /128 f eclk hz left-aligned pwm frequency 8-bit 16-bit f lpwm f eclk /1m f eclk /256m f eclk /2 f eclk /2 hz hz left-aligned pwm resolution r lpwm f eclk /4k f eclk hz center-aligned pwm frequency 8-bit 16-bit f cpwm f eclk /2m f eclk /512m f eclk f eclk hz hz center-aligned pwm resolution r cpwm f eclk /4k f eclk hz 10-elec
electrical characteristics tables of data mc68hc912dt128a rev 2.0 motorola electrical characteristics 361 11-elec 1. reset is recognized during the first clock cycle it is held low. internal circuitry then drives the pin low for 16 clock cycles, releases the pin, and samples the pin level 8 cycles later to determine the source of the interrupt. figure 62 timer inputs table 76 control timing characteristic symbol 8.0 mhz unit min max frequency of operation f o 0.004 8.0 mhz e-clock period t cyc 0.125 250 s crystal frequency f xtal 0.5 16.0 mhz external oscillator frequency f eo 0.5 16.0 mhz processor control setup time t pcsu = t cyc / 2 + 30 t pcsu 92 ? ns reset input pulse width to guarantee external reset vector minimum input time (can be preempted by internal reset) pw rstl 32 2 ? ? t cyc t cyc mode programming setup time t mps 4 ? t cyc mode programming hold time t mph 20 ? ns interrupt pulse width, irq edge-sensitive mode pw irq = 2t cyc + 20 pw irq 270 ? ns wait recovery startup time t wrs ? 4 cycles timer input capture pulse width pw tim 270 ? ns pt7 2 pt7 1 pt[7:0] 2 pt[7:0] 1 notes : 1. rising edge sensitive input 2. falling edge sensitive input pw tim pw pa
electrical characteristics mc68hc912dt128a rev 2.0 362 electrical characteristics motorola figure 63 por and external reset timing diagram t pcsu internal moda, modb eclk extal v dd reset 4098 t cyc free fffe fffe 3rd 1st 2nd free fffe fffe fffe t mph pw rstl t mps address pipe pipe pipe 1st exec 3rd pipe 2nd pipe 1st pipe 1st exec note: reset timing is subject to change. 12-elec
electrical characteristics tables of data mc68hc912dt128a rev 2.0 motorola electrical characteristics 363 13-elec figure 64 stop recovery timing diagram pw irq t stopdelay 3 irq 1 irq or xirq eclk 1st address 4 sp-9 free free vector free free resume program with instruction which follows the stop instruction. internal address 5 clocks notes: 1. edge sensitive irq pin (irqe bit = 1) 2. level sensitive irq pin (irqe bit = 0) 3. t stopdelay = 4098 t cyc if dly bit = 1 or 2 t cyc if dly = 0. 4. xirq with x bit in ccr = 1. 5. irq or (xirq with x bit in ccr = 0). opt 1st 2nd 3rd 1st exec pipe pipe exec sp-8 sp-6 fetch pipe sp-6 sp-8 sp-9
electrical characteristics mc68hc912dt128a rev 2.0 364 electrical characteristics motorola figure 65 wait recovery timing diagram t pcsu pc, iy, ix, b:a, , ccr stack registers eclk r/w address irq , xirq , or internal interrupts sp ? 2 sp ? 4 sp ? 6 . . . sp ? 9 sp ? 9 sp ? 9 . . . sp ? 9 sp ? 9 vector free 1st 2nd 3rd pipe t wrs note: reset also causes recovery from wait. address pipe pipe 1st exec 14-elec
electrical characteristics tables of data mc68hc912dt128a rev 2.0 motorola electrical characteristics 365 15-elec figure 66 interrupt timing diagram eclk pw irq 1st 3rd address irq 1 sp ? 9 t pcsu irq 2 , xirq , or internal interrupt vector sp ? 2 1st sp ? 4 sp ? 6 2nd sp ? 8 data vect pc iy ix b:a ccr prog r/w notes: 1. edge sensitive irq pin (irqe bit = 1) 2. level sensitive irq pin (irqe bit = 0) fetch addr exec pipe pipe pipe prog fetch prog fetch
electrical characteristics mc68hc912dt128a rev 2.0 366 electrical characteristics motorola figure 67 port read timing diagram figure 68 port write timing diagram table 77 peripheral port timing characteristic symbol 8.0 mhz unit min max frequency of operation (e-clock frequency) f o 0.004 8.0 mhz e-clock period t cyc 0.125 250 s peripheral data setup time mcu read of ports t pdsu 81 ? ns peripheral data hold time mcu read of ports t pdh 0 ? ns delay time, peripheral data write mcu write to ports except port can t pwd ? 40 ns delay time, peripheral data write mcu write to port can t pwd ? 71 ns port rd tim eclk mcu read of port ports t pdsu t pdh port wr tim eclk mcu write to port previous port data new data valid port a t pwd 16-elec
electrical characteristics tables of data mc68hc912dt128a rev 2.0 motorola electrical characteristics 367 17-elec table 78 multiplexed expansion bus timing v dd = 5.0 vdc 10%, v ss = 0 vdc, t a = t l to t h , unless otherwise noted num characteristic (1), (2), (3), (4) 1. all timings are calculated for normal port drives. 2. crystal input is required to be within 45% to 55% duty. 3. reduced drive must be off to meet these timings. 4. unequalled loading of pins will affect relative timing numbers. delay symbol 8 mhz unit min max frequency of operation (e-clock frequency) f o 0.004 8.0 mhz 1 cycle time t cyc = 1 / f o ? t cyc 0.125 250 s 2 pulse width, e low pw el = t cyc / 2 + delay ? 2pw el 60 ns 3 pulse width, e high (5) pw eh = t cyc / 2 + delay 5. this characteristic is affected by clock stretch. add n t cyc where n = 0, 1, 2, or 3, depending on the number of clock stretches. ? 2pw eh 60 ns 5 address delay time t ad = t cyc / 4 + delay 14 t ad 45 ns 7 address valid time to eclk rise t av = pw el ? t ad ? t av 15 ns 8 multiplexed address hold time t mah = t cyc / 4 + delay ? 16 t mah 15 ns 9 address hold to data valid ? t ahds 5ns 10 data hold to high z t dhz = t ad ? 20 ? t dhz 20 ns 11 read data setup time ? t dsr 38 ns 12 read data hold time ? t dhr 0ns 13 write data delay time t ddw = t cyc / 4 + delay 14 t ddw 45 ns 14 write data hold time t dhw = t cyc / 4 + delay ? 11 t dhw 20 ns 15 write data setup time (5) t dsw = pw eh ? t ddw ? t dsw 15 ns 16 read/write delay time t rwd = t cyc / 4 + delay 19 t rwd 50 ns 17 read/write valid time to e rise t rwv = pw el ? t rwd ? t rwv 10 ns 18 read/write hold time t rwh = t cyc / 4 + delay ?2 6t rwh 5ns 19 low strobe (6) delay time t lsd = t cyc / 4 + delay 6. without tag enabled. 26 t lsd 57 ns 20 low strobe (6) valid time to e rise t lsv = pw el ? t lsd ? t lsv 3ns 21 low strobe (6) hold time t lsh = t cyc / 4 + delay ?2 6t lsh 5ns 22 address access time (5) t acca = t cyc ? t ad ? t dsr ? t acca 26 ns 23 access time from e rise (5) t acce = pw eh ? t dsr ? t acce 22 ns 24 dbe delay from eclk rise (5) t dbed = t cyc / 4 + delay 20 t dbed 51 ns 25 dbe valid time t dbe = pw eh ? t dbed ? t dbe 9ns 26 dbe hold time from eclk fall t dbeh 010ns
electrical characteristics mc68hc912dt128a rev 2.0 368 electrical characteristics motorola figure 69 multiplexed expansion bus timing diagram dbe 24 25 eclk r/w 1 2 3 18 11 12 14 note: measurement points shown are 20% and 70% of v dd 13 16 17 read write 23 lstrb 21 19 20 (w/o tag enabled) 5 7 22 8 15 address/data multiplexed address address data data 10 9 26 18-elec
electrical characteristics tables of data mc68hc912dt128a rev 2.0 motorola electrical characteristics 369 19-elec table 79 spi timing (v dd = 5.0 vdc 10%, v ss = 0 vdc, t a = t l to t h , 200 pf load on all spi pins) (1) num function symbol min max unit operating frequency master slave f op 1/256 1/256 1 / 2 1 / 2 f eclk sck period master slave t sck 2 2 256 ? t cyc t cyc enable lead time master slave t lead 1 / 2 1 ? ? t sck t cyc enable lag time master slave t lag 1 / 2 1 ? ? t sck t cyc clock (sck) high or low time master slave t wsck t cyc ? 60 t cyc ? 30 128 t cyc ? ns ns sequential transfer delay master slave t td 1 / 2 1 ? ? t sck t cyc data setup time (inputs) master slave t su 30 30 ? ? ns ns data hold time (inputs) master slave t hi 0 30 ? ? ns ns slave access time t a ? 1t cyc slave miso disable time t dis ? 1t cyc data valid (after sck edge) master slave t v ? ? 50 50 ns ns data hold time (outputs) master slave t ho 0 0 ? ? ns ns rise time input output t ri t ro ? ? t cyc ? 30 30 ns ns fall time input output t fi t fo ? ? t cyc ? 30 30 ns ns 1. all ac timing is shown with respect to 20% v dd and 70% v dd levels unless otherwise noted.
electrical characteristics mc68hc912dt128a rev 2.0 370 electrical characteristics motorola a) spi master timing (cpha = 0) b) spi master timing (cpha = 1) figure 70 spi timing diagram (1 of 2) sck (output) sck (output) miso (input) mosi (output) ss 1 (output) 1 10 6 7 msb in 2 bit 6 . . . 1 lsb in msb out 2 lsb out bit 6 . . . 1 11 4 4 2 10 (cpol = 0) (cpol = 1) 5 3 12 13 1. ss output mode (dds7 = 1, ssoe = 1). 2. lsbf = 0. for lsbf = 1, bit order is lsb, bit 1, ..., bit 6, msb. sck (output) sck (output) miso (input) mosi (output) 1 6 7 msb in 2 bit 6 . . . 1 lsb in master msb out 2 master lsb out bit 6 . . . 1 4 4 10 12 13 11 port data (cpol = 0) (cpol = 1) port data ss 1 (output) 5 2 13 12 3 1. ss output mode (dds7 = 1, ssoe = 1). 2. lsbf = 0. for lsbf = 1, bit order is lsb, bit 1, ..., bit 6, msb. 20-elec
electrical characteristics tables of data mc68hc912dt128a rev 2.0 motorola electrical characteristics 371 a) spi slave timing (cpha = 0) b) spi slave timing (cpha = 1) figure 71 spi timing diagram (2 of 2) sck (input) sck (input) mosi (input) miso (output) ss (input) 1 10 6 7 msb in bit 6 . . . 1 lsb in msb out slave lsb out bit 6 . . . 1 11 4 4 2 8 (cpol = 0) (cpol = 1) 5 3 13 note: not defined but normally msb of character just received. slave 13 12 11 see 12 note 9 spi slave cpha1 sck (input) sck (input) mosi (input) miso (output) 1 6 7 msb in bit 6 . . . 1 lsb in msb out slave lsb out bit 6 . . . 1 4 4 10 12 13 11 see (cpol = 0) (cpol = 1) ss (input) 5 2 13 12 3 note: not defined but normally lsb of character just received. slave note 8 9
electrical characteristics mc68hc912dt128a rev 2.0 372 electrical characteristics motorola table 80 cgm characteristics 5.0 volts +/- 10% characteristic symbol min. max. unit pll reference frequency, crystal oscillator range (1) f ref 0.5 8 mhz bus frequency f bus 0.004 8 mhz vco range f vco 2.5 8 mhz vco limp-home frequency f vcomin 0.5 2.5 mhz lock detector transition from acquisition to tracking mode ? trk 3% 4% ? lock detection ? lock 0% 1.5% ? un-lock detection ? unl 0.5% 2.5% ? lock detector transition from tracking to acquisition mode ? unt 6% 8% ? pllon stabilization delay (2) pllon total stabilization delay (3) t stab 3ms pllon acquisition mode stabilization delay (3) t acq 1ms pllon tracking mode stabilization delay (3) t al 2ms 1. vddpll at vdd level. 2. pll stabilization delay is highly dependent on operational requirement and external component values (e.e. crystal, xfc filter component values). note (3) shows typical delay values for a typical configuration. appropriate xfc filter values should be chosen based on operational requirement of system. 3. f ref = 4mhz, f sys = 8mhz (refdv = #$00, synr = #$01), xfc: cs = 33nf, cp - 3.3nf, rs = 2.7k ? . table 81 stop key wake-up filter characteristic symbol min. max. unit stop key wake-up filter time t kwstp 210 s stop key wake-up filter pulse interval t kwsp 20 - s
mc68hc912dt128a rev 2.0 motorola appendix a: mc68hc912dt128a 373 appendix a: mc68hc912dt128a appendix a: mc68hc912dt128a contents 6. port adx 375 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373 1. flash . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373 2. eeprom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 374 3. stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375 4. wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375 5. kwu filter. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375 6. port adx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375 7. atd. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375 significant changes from the mc68hc912dg128 (non-a suffix device) 1. flash 1a. flash architecture the flash arrays are made from a new non-volatile memory (nvm) technology. an external vfp is no longer used. programming is now carried out on a whole row (64 bytes) at a time. erasing is still a bulk erase of the entire array. 1b. flash control register the flash control register (feectl) is in the same location. however, the individual bit functions have changed significantly to support the new technology. 1c. flash programming procedure programming of the flash is greatly simplified over previous hc12s. the read / verify / re-pulse programming algorithm is replaced by a much simpler method. 1-appa
appendix a: mc68hc912dt128a mc68hc912dt128a rev 2.0 374 appendix a: mc68hc912dt128a motorola 1d. flash programming time the most significant change resulting from the new flash technology is that the bulk erase and program times are now fixed. the erase time is at least twice as fast while the word programming time is at least 20% faster. 1e. flash external programming voltage the new flash does not require an external high voltage supply. all voltages required for programming and erase are now generated internally. pin 97 that was the vfp pin on the 68hc912dg128 is now a factory test pin. on ealy production devices it is recommended that this pin is not connected within the application, but it may be connected to vss or 5.5v max without issue. on later production parts this pin is not bonded out. 2. eeprom 2a. eeprom architecture like the flash, the eeprom is also made from this new nvm technology. the architecture and basic programming and erase operations are unchanged. however, there is a new optional programming method that allows faster programming of the eeprom. 3b. eeprom clock source and pre-scaler the first major difference on the new eeprom is that it requires a constant time base source to ensure secure programming and erase operations. the clock source that is going to drive the clock divider input is the external clock input, extali. the divide ratio from this source has to be set by programming an 10-bit time base pre-scalar into bits spread over two new registers, eedivh and eedivl. the eedivh and eedivl registers are volatile. however, they are loaded upon reset by the contents of the non-volatile shadow word much in the same way as the eeprom module control register (eemcr) bits interact with the shadow word for configuration control on the existing revision. 2c. eeprom auto programming & erasing the second major change to the eeprom is the inclusion in the eeprom control register (eeprog) of an auto function using the previously unused bit 5 of this register. 2-appa
appendix a: mc68hc912dt128a significant changes from the mc68hc912dg128 (non-a suffix device) mc68hc912dt128a rev 2.0 motorola appendix a: mc68hc912dt128a 375 3-appa the auto function enables the logic of the mcu to automatically use the optimum programming or erasing time for the eeprom. if using auto, the user does not need to wait for the normal minimum specified programming or erasing time. after setting the eepgm bit as normal the user just has to poll that bit again, waiting for the mcu to clear it indicating that programming or erasing is complete. 2d. eeprom selective write more zeros for some applications it may be advantageous to track more than 10k events with a single byte of eeprom by programming one bit at a time. for that purpose, a special selective bit programming technique is available. when this technique is utilized, a program / erase cycle is defined as multiple writes (up to eight) to a unique location followed by a single erase sequence. 3. stop mode this new version will correctly exit stop mode without having to synchronize the start of stop with the rti clock. 4. wait mode this new version will correctly exit wait mode using short xirq or irq inputs. 5. kwu filter the kwu filter will now ignore pulses shorter than 2 microseconds. 6. port adx power must be applied to vdda at all times even if the adc is not being used. this is necessary for port ad0 and port ad1 to function correctly as digital inputs. 7. atd bit cc of atdxctl5 is not masked when bit s8cm = 1.
appendix a: mc68hc912dt128a mc68hc912dt128a rev 2.0 376 appendix a: mc68hc912dt128a motorola 4-appa
mc68hc912dt128a rev 2.0 motorola appendix b: cgm practical aspects 377 appendix b: cgm practical aspects appendix b: cgm practical aspects contents introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377 a few hints for the cgm crystal oscillator application . . . . . . . . . 377 practical aspects for the pll usage . . . . . . . . . . . . . . . . . . . . . . . 380 printed circuit board guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385 introduction this sections provides useful and practical pieces of information concerning the implementation of the cgm module. a few hints for the cgm crystal oscillator application what loading capacitors to choose? first, from small-signal analysis, it is known that relatively large values for c1 and c2 have a positive impact on the phase margin. however, the higher loading they represent decreases the loop gain. alternatively, small values for these capacitors will lead to higher open loop gain, but as the frequency of oscillation approaches the parallel resonance, the phase margin, and consequently the ability to start-up correctly, will decrease. from this it is clear that relatively large capacitor values (>33pf), are reserved for low frequency crystals in the mhz range. note: using the recommended loading capacitor cl value from the crystal manufacturer is a good starting point. taking into account unavoidable strays, this equates to about (cl-2pf). 1-cgmpa
appendix b: cgm practical aspects mc68hc912dt128a rev 2.0 378 appendix b: cgm practical aspects motorola theoretically speaking, nothing precludes the use of non-identical values for c1 and c2. as this complicate a bit the management of the final board device list, this is not recommended. however, if asymmetrical capacitors are chosen, the value of c1 should be higher than c2 (because the reflected loading is proportional to the square of the impedance of c2). dc bias due to the nature of the translated ground colpitts oscillator a dc voltage bias is applied to the crystal. please contact the crystal manufacturer for specific dc bias conditions and recommended capacitance value (if applicable). what is the final oscillation frequency? the exact calculation is not straightforward as it takes into account the resonator characteristics and the loading capacitors values as well as internal design parameters which can vary with process voltage temperature (pvt) conditions. nevertheless, if l is the series inductance, r is the series resistance, c is the series capacitance and cc the parallel capacitance of the crystal, we can then use the following simplified equation: how do i control the peak to peak oscillation amplitude? the cgm oscillator is equipped with an amplitude limitation control loop which integrates the peak to peak ? extal ? amplitude and in return reduces the steady current of the transconductor device until a stable quiescent point is reached. controlling this final peak to peak amplitude can be performed by three means: 1. reducing the values of c1 and c2. this decreases the loading so that the necessary gm value required to sustain oscillation can be fosc 1 2 || () ? ? ?? ? () ? ? 2-cgmpa
appendix b: cgm practical aspects a few hints for the cgm crystal oscillator application mc68hc912dt128a rev 2.0 motorola appendix b: cgm practical aspects 379 smaller. the consequently smaller current will be reached with a larger ? extal ? swing. 2. using vddpll=vss (i.e. shutting off the pll). doing so increases the starting current by approximately 50%. all other parameters staying the same, a larger ? extal ? swing will be required to reduce this starting current to its quiescent value. 3. also, placing a high value resistor (>1m ? ) across the extal and xtal pins significantly increased the oscillation amplitude. because this complicates the design analysis as it transforms a pure susceptance j c1 into a complex admittance g+j c1, motorola cannot promote this application trick. what do i do in case the oscillator does not start-up? 1. first, verify that the application schematic respects the principle of operation, i.e. crystal mounted between extal and vss, capacitor c1 between xtal and extal, capacitor c2 between xtal and vss, nothing else. this is not the conventional mcu application schematic of the pierce oscillator as it can be seen on other hc12 derivatives! 2. re-consider the choice of the tuning capacitors. 3. if the quartz or resonator is of a high frequency type (e.g. above 10mhz), consider using vddpll=0v. obviously, this choice precludes the use of the pll. however, in this case the oscillator circuitry has more quiescent current available and the starting transconductance is thus significantly higher. 4. the oscillator circuitry is powered internally from a core vdd pad and the return path is the vsspll pad. verify on the application pcb the correct connection of these pads (especially vsspll), but also verify the waveform of the vdd voltage as it is imposed on the pad. sometimes external components (for instance choke inductors), can cause oscillations on the power line. this is of course detrimental to the oscillator circuitry. 5. if possible, consider using a resonator with built-in tuning capacitors. they may offer better performances with respect to their discrete elements implementation. 3-cgmpa
appendix b: cgm practical aspects mc68hc912dt128a rev 2.0 380 appendix b: cgm practical aspects motorola practical aspects for the pll usage synthesized bus frequency starting from a ceramic resonator or quartz crystal frequency f xtal , if ? refdv ? and ? synr ? are the decimal content of the refdv and synr registers respectively, then the mcu bus frequency will simply be: note: it is not allowed to synthesize a bus frequency that is lower than the crystal frequency, as the correct functioning of some internal synchronizers would be jeopardized (e.g. the mclk and xclk clock generators). operation under adverse environmental conditions the normal operation for the pll is the so-called ? automatic bandwidth selection mode ? which is obtained by having the auto bit set in the pllcr register. when this mode is selected and as the vco frequency approaches its target, the charge pump current level will automatically switch from a relatively high value of around 40 a to a lower value of about 3 a. it can happen that this low level of charge pump current is not enough to overcome leakages present at the xfc pin due to adverse environmental conditions. these conditions are frequently encountered for uncoated pcbs in automotive applications. the main symptom for this failure is an unstable characteristic of the pll which in fact ? hunts ? between acquisition and tracking modes. it is then advised for the running software to place the pll in manual, forced acquisition mode by clearing both the auto and the acq bits in the pllcr register. doing so will maintain the high current level in the charge pump constantly and will permit to sustain higher levels of leakages at the xfc pin. this latest revision of the clock generator module maintains the lock detection feature even in manual bandwidth control, offering then to the application software the same flexibility for the clocking control as the automatic mode. f bus f vco f xtal synr 1 + () ? () { { 4-cgmpa
appendix b: cgm practical aspects practical aspects for the pll usage mc68hc912dt128a rev 2.0 motorola appendix b: cgm practical aspects 381 filter components selection guide equations set these equations can be used to select a set of filter components. two cases are considered: 1. the ? tracking ? mode. this situation is reached normally when the pll operates in automatic bandwidth selection mode (auto=1 in the pllcr register). 2. the ? acquisition ? mode. this situation is reached when the pll operates in manual bandwidth selection mode and forced acquisition (auto=0, acq =0 in the pllcr register). in both equations, the power supply should be 5v. start with the target loop bandwidth as a function of the other parameters, but obviously, nothing prevents the user from starting with the capacitor value for example. also, remember that the smoothing capacitor is always assumed to be one tenth of the series capacitance value. so with: m: the multiplying factor for the reference frequency (i.e. (synr+1)) r: the series resistance of the low pass filter in ? c: the series capacitance of the low pass filter in nf f bus : the target bus frequency expressed in mhz : the desired damping factor f c : the desired loop bandwidth expressed in hz for the ? tracking ? mode: and for the ? acquisition ? mode: f c 210 9 ?? ?? 10.795 ----------------------------- ?? ?? r ?? 2 m ?? ----------------------------------------------------- - == f c 210 9 2 ?? rc ?? ------------------------- 415.61 e 1.675 f bus ? 10.795 ----------------------------- ?? ?? r ?? 2 m ?? -------------------------------------------------------- - == 5-cgmpa
appendix b: cgm practical aspects mc68hc912dt128a rev 2.0 382 appendix b: cgm practical aspects motorola particular case of an 8mhz synthesis assume that a desired value for the damping factor of the second order system is close to 0.9 as this leads to a satisfactory transient response. then, derived from the equations above, table 82 and table 83 suggest sets of values corresponding to several loop bandwidth possibilities in the case of an 8mhz synthesis for the two cases mentioned above. the filter components values are chosen from standard series (e.g. e12 for resistors). the operating voltage is assumed to be 5v (although there is only a minor difference between 3v and 5v operation). the smoothing capacitor cp in parallel with r and c is set to be 1/10 of the value of c. the reference frequencies mentioned in this table correspond to the output of the fine granularity divider controlled by the refdv register. this means that the calculations are irrespective of the way the reference frequency is generated (directly for the crystal oscillator or after division). the target frequency value also has an influence on the calculations of the filter components because the vco gain is not constant over its operating range. the bandwidth limit corresponds to the so-called gardner ? s criteria. it corresponds to the maximum value that can be chosen before the continuous time approximation ceases to be justified. it is of course advisable to stay far away from this limit. 6-cgmpa
appendix b: cgm practical aspects practical aspects for the pll usage mc68hc912dt128a rev 2.0 motorola appendix b: cgm practical aspects 383 7-cgmpa table 82 suggested 8mhz synthesis pll filter elements (tracking mode) reference [mhz] synr fbus [mhz] c [nf] r [k ? ] loop bandwidth [khz] bandwidth limit [khz] 0.614 $0c 7.98 100 4.3 1.1 157 0.614 $0c 7.98 4.7 20 5.3 157 0.614 $0c 7.98 1 43 11.5 157 0.614 $0c 7.98 0.33 75 20 157 0.8 $09 8.00 220 2.7 0.9 201 0.8 $09 8.00 10 12 4.2 201 0.8 $09 8.00 2.2 27 8.6 201 0.8 $09 8.00 0.47 56 19.2 201 1 $07 8.00 220 2.4 1 251 1 $07 8.00 10 11 4.7 251 1 $07 8.00 2.2 24 9.9 251 1 $07 8.00 0.47 51 21.4 251 1.6 $05 8.00 330 1.5 1 402 1.6 $05 8.00 10 9.1 5.9 402 1.6 $05 8.00 3.3 15 10.2 402 1.6 $05 8.00 1 27 18.6 402 2 $03 8.00 470 1.1 0.96 502 2 $03 8.00 22 5.1 4.4 502 2 $03 8.00 4.7 11 9.6 502 2 $03 8.00 1 24 20.8 502 2.66 $02 8.00 220 1.5 1.6 668 2.66 $02 8.00 22 4.7 5.1 668 2.66 $02 8.00 4.7 10 11 668 2.66 $02 8.00 1 22 24 668 4 $01 8.00 220 1.2 1.98 1005 4 $01 8.00 33 3 5.1 1005 4 $01 8.00 10 5.6 9.3 1005 4 $01 8.00 2.2 12 19.8 1005
appendix b: cgm practical aspects mc68hc912dt128a rev 2.0 384 appendix b: cgm practical aspects motorola table 83 suggested 8mhz synthesis pll filter elements (acquisition mode) reference [mhz] synr fbus [mhz] c [nf] r [k ? ] loop bandwidth [khz] bandwidth limit [khz] 0.614 $0c 7.98 1000 0.43 1.2 157 0.614 $0c 7.98 47 2 5.5 157 0.614 $0c 7.98 10 4.3 12 157 0.614 $0c 7.98 3.3 7.5 21 157 0.8 $09 8.00 2200 0.27 0.9 201 0.8 $09 8.00 100 1.2 4.4 201 0.8 $09 8.00 22 2.4 9.3 201 0.8 $09 8.00 4.7 5.6 20.1 201 1 $07 8.00 2200 0.22 1 251 1 $07 8.00 100 1 4.8 251 1 $07 8.00 2. 2.2 10.4 251 1 $07 8.00 4.7 4.7 22.5 251 1.6 $05 8.00 3300 0.15 1.1 402 1.6 $05 8.00 100 0.82 6.2 402 1.6 $05 8.00 33 1.5 10.7 402 1.6 $05 8.00 10 2.7 19.5 402 2 $03 8.00 4700 0.1 1 502 2 $03 8.00 220 0.51 4.6 502 2 $03 8.00 47 1 10 502 2 $03 8.00 10 2.4 21.8 502 2.66 $02 8.00 2200 0.12 1.7 668 2.66 $02 8.00 220 0.43 5.3 668 2.66 $02 8.00 47 1 11.6 668 2.66 $02 8.00 10 2 25.1 668 4 $01 8.00 2200 0.1 2.1 1005 4 $01 8.00 330 0.27 5.4 1005 4 $01 8.00 100 0.51 9.7 1005 4 $01 8.00 22 1 20.8 1005 8-cgmpa
appendix b: cgm practical aspects printed circuit board guidelines mc68hc912dt128a rev 2.0 motorola appendix b: cgm practical aspects 385 9-cgmpa printed circuit board guidelines printed circuit boards (pcbs) are the board of choice for volume applications. if designed correctly, a very low noise system can be built on a pcb with consequently good emi/emc performances. if designed incorrectly, pcbs can be extremely noisy and sensitive modules, and the cgm could be disrupted. some common sense rules can be used to prevent such problems.  use a ? star ? style power routing plan as opposed to a ? daisy chain ? . route power and ground from a central location to each chip individually, and use the widest trace practical (the more the chip draws current, the wider the trace). never place the mcu at the end of a long string of serially connected chips.  when using pcb layout software, first direct the routing of the power supply lines as well as the cgm wires (crystal oscillator and pll). layout constraints must be then reported on the other signals and not on these ? hot ? nodes. optimizing the ? hot ? nodes at the end of the routing process usually gives bad results.  avoid notches in power traces. these notches not only add resistance (and are not usually accounted for in simulations), but they can also add unnecessary transmission line effects.  avoid ground and power loops. this has been one of the most violated guidelines of pcb layout. loops are excellent noise transmitters and can be easily avoided. when using multiple layer pcbs, the power and ground plane concept works well but only when strictly adhered to (do not compromise the ground plane by cutting a hole in it and running signals on the ground plane layer). keep the spacing around via holes to a minimum (but not so small as to add capacitive effects).  be aware of the three dimensional capacitive effects of multi-layered pcbs.  bypass (decouple) the power supplies of all chips as close to the chip as possible. use one decoupling capacitor per power supply pair (vdd/vss, vddx/vssx...). two capacitors with a ratio of about 100 sometimes offer better performances over a broader
appendix b: cgm practical aspects mc68hc912dt128a rev 2.0 386 appendix b: cgm practical aspects motorola spectrum. this is especially the case for the power supply pins close to the e port, when the e clock and/or the calibration clock are used.  on the general vdd power supply input, a ? t ? low pass filter lcl can be used (e.g. 10 h-47 f-10 h). the ? t ? is preferable to the ? ? version as the exhibited impedance is more constant with respect to the vdd current. like many modular micro controllers, hc12 devices have a power consumption which not only varies with clock edges but also with the functioning modes.  keep high speed clock and bus trace length to a minimum. the higher the clock speed, the shorter the trace length. if noisy signals are sent over long tracks, impedance adjustments should be considered at both ends of the line (generally, simple resistors suffice).  bus drivers like the can physical interface should be installed close to their connector, with dedicated filtering on their power supply.  mount components as close to the board as possible. snip excess lead length as close to the board as possible. preferably use surface mount devices (smds).  mount discrete components as close to the chip that uses them as possible.  do not cross sensitive signals on any layer. if a sensitive signal must be crossed by another signal, do it as many layers away as possible and at right angles.  always keep pcbs clean. solder flux, oils from fingerprints, humidity and general dirt can conduct electricity. sensitive circuits can easily be disrupted by small amounts of leakage.  choose pcb coatings with care. certain epoxies, paints, gelatins, plastics and waxes can conduct electricity. if the manufacturer cannot provide the electrical characteristics of the substance, do not use it. 10-cgmpa
appendix b: cgm practical aspects printed circuit board guidelines mc68hc912dt128a rev 2.0 motorola appendix b: cgm practical aspects 387 11-cgmpa in addition to the above general pieces of advice, the following guidelines should be followed for the cgm pins (but also more generally for any sensitive analog circuitry):  mount the pll filter and oscillator components as close to the mcu as possible.  do not allow the extal and xtal signals to interfere with the xfc node. keep these tracks as short as possible.  do not cross the cgm signals with any other signal on any level.  remember that the reference voltage for the xfc filter is vddpll.  as the return path for the oscillator circuitry is vsspll, it is extremely important to connect vsspll to vss even if the pll is not to be powered.surface mount components reduce the susceptibility of signal contamination.  ceramic resonators with built-in capacitors are available. this is an interesting solution because the parasitic components involved are minimized due to the close proximity of the resonating elements.
appendix b: cgm practical aspects mc68hc912dt128a rev 2.0 388 appendix b: cgm practical aspects motorola 12-cgmpa
mc68hc912dt128a rev 1.0 motorola glossary 389 glossary glossary a ? see ? accumulators (a and b or d). ? accumulators (a and b or d) ? two 8-bit (a and b) or one 16-bit (d) general-purpose registers in the cpu. the cpu uses the accumulators to hold operands and results of arithmetic and logic operations. acquisition mode ? a mode of pll operation with large loop bandwidth. also see ? tracking mode ? . address bus ? the set of wires that the cpu or dma uses to read and write memory locations. addressing mode ? the way that the cpu determines the operand address for an instruction. the m68hc12 cpu has 15 addressing modes. alu ? see ? arithmetic logic unit (alu). ? analogue-to-digital converter (atd) ? the atd module is an 8-channel, multiplexed-input successive-approximation analog-to-digital converter. arithmetic logic unit (alu) ? the portion of the cpu that contains the logic circuitry to perform arithmetic, logic, and manipulation operations on operands. asynchronous ? refers to logic circuits and operations that are not synchronized by a common reference signal. atd ? see ? analogue-to-digital converter ? .
glossary mc68hc912dt128a rev 1.0 390 glossary motorola b ? see ? accumulators (a and b or d). ? baud rate ? the total number of bits transmitted per unit of time. bcd ? see ? binary-coded decimal (bcd). ? binary ? relating to the base 2 number system. binary number system ? the base 2 number system, having two digits, 0 and 1. binary arithmetic is convenient in digital circuit design because digital circuits have two permissible voltage levels, low and high. the binary digits 0 and 1 can be interpreted to correspond to the two digital voltage levels. binary-coded decimal (bcd) ? a notation that uses 4-bit binary numbers to represent the 10 decimal digits and that retains the same positional structure of a decimal number. for example, 234 (decimal) = 0010 0011 0100 (bcd) bit ? a binary digit. a bit has a value of either logic 0 or logic 1. branch instruction ? an instruction that causes the cpu to continue processing at a memory location other than the next sequential address. break module ? the break module allows software to halt program execution at a programmable point in order to enter a background routine. breakpoint ? a number written into the break address registers of the break module. when a number appears on the internal address bus that is the same as the number in the break address registers, the cpu executes the software interrupt instruction (swi). break interrupt ? a software interrupt caused by the appearance on the internal address bus of the same value that is written in the break address registers. bus ? a set of wires that transfers logic signals. bus clock ? see "cpu clock". byte ? a set of eight bits.
glossary mc68hc912dt128a rev 1.0 motorola glossary 391 can ? see "motorola scalable can." ccr ? see ? condition code register. ? central processor unit (cpu) ? the primary functioning unit of any computer system. the cpu controls the execution of instructions. cgm ? see ? clock generator module (cgm). ? clear ? to change a bit from logic 1 to logic 0; the opposite of set. clock ? a square wave signal used to synchronize events in a computer. clock generator module (cgm) ? the cgm module generates a base clock signal from which the system clocks are derived. the cgm may include a crystal oscillator circuit and/or phase-locked loop (pll) circuit. comparator ? a device that compares the magnitude of two inputs. a digital comparator defines the equality or relative differences between two binary numbers. computer operating properly module (cop) ? a counter module that resets the mcu if allowed to overflow. condition code register (ccr) ? an 8-bit register in the cpu that contains the interrupt mask bit and five bits that indicate the results of the instruction just executed. control bit ? one bit of a register manipulated by software to control the operation of the module. control unit ? one of two major units of the cpu. the control unit contains logic functions that synchronize the machine and direct various operations. the control unit decodes instructions and generates the internal control signals that perform the requested operations. the outputs of the control unit drive the execution unit, which contains the arithmetic logic unit (alu), cpu registers, and bus interface.
glossary mc68hc912dt128a rev 1.0 392 glossary motorola cop ? see "computer operating properly module (cop)." cpu ? see ? central processor unit (cpu). ? cpu12 ? the cpu of the mc68hc12 family. cpu clock ? bus clock select bits bcsp and bcss in the clock select register (clksel) determine which clock drives sysclk for the main system, including the cpu and buses. when extali drives the sysclk, the cpu or bus clock frequency (f o ) is equal to the extali frequency divided by 2. cpu cycles ? a cpu cycle is one period of the internal bus clock, normally derived by dividing a crystal oscillator source by two or more so the high and low times will be equal. the length of time required to execute an instruction is measured in cpu clock cycles. cpu registers ? memory locations that are wired directly into the cpu logic instead of being part of the addressable memory map. the cpu always has direct access to the information in these registers. the cpu registers in an m68hc12 are:  a (8-bit accumulator)  b (8-bit accumulator) ? d (16-bit accumulator formed by concatenation of accumulators a and b)  ix (16-bit index register)  iy (16-bit index register)  sp (16-bit stack pointer)  pc (16-bit program counter)  ccr (8-bit condition code register) cycle time ? the period of the operating frequency: t cyc =1/f op . d ? see ? accumulators (a and b or d). ? decimal number system ? base 10 numbering system that uses the digits zero through nine. duty cycle ? a ratio of the amount of time the signal is on versus the time it is off. duty cycle is usually represented by a percentage.
glossary mc68hc912dt128a rev 1.0 motorola glossary 393 ect ? see ? enhanced capture timer. ? eeprom ? electrically erasable, programmable, read-only memory. a nonvolatile type of memory that can be electrically erased and reprogrammed. eprom ? erasable, programmable, read-only memory. a nonvolatile type of memory that can be erased by exposure to an ultraviolet light source and then reprogrammed. enhanced capture timer (ect) ? the hc12 enhanced capture timer module has the features of the hc12 standard timer module enhanced by additional features in order to enlarge the field of applications. exception ? an event such as an interrupt or a reset that stops the sequential execution of the instructions in the main program. fetch ? to copy data from a memory location into the accumulator. firmware ? instructions and data programmed into nonvolatile memory. flash eeprom ? electrically erasable, programmable, read-only memory. a nonvolatile type of memory that can be electrically erased and reprogrammed. does not support byte or word erase. free-running counter ? a device that counts from zero to a predetermined number, then rolls over to zero and begins counting again. full-duplex transmission ? communication on a channel in which data can be sent and received simultaneously. hexadecimal ? base 16 numbering system that uses the digits 0 through 9 and the letters a through f. high byte ? the most significant eight bits of a word. illegal address ? an address not within the memory map illegal opcode ? a nonexistent opcode. index registers (ix and iy) ? two 16-bit registers in the cpu. in the indexed addressing modes, the cpu uses the contents of ix or iy to determine the effective address of the operand. ix and iy can also serve as a temporary data storage locations. input/output (i/o) ? input/output interfaces between a computer system and the external world. a cpu reads an input to sense the level of an external signal and writes to an output to change the level on an external signal.
glossary mc68hc912dt128a rev 1.0 394 glossary motorola instructions ? operations that a cpu can perform. instructions are expressed by programmers as assembly language mnemonics. a cpu interprets an opcode and its associated operand(s) and instruction. interrupt ? a temporary break in the sequential execution of a program to respond to signals from peripheral devices by executing a subroutine. interrupt request ? a signal from a peripheral to the cpu intended to cause the cpu to execute a subroutine. i/o ? see ? input/output (i/0). ? jitter ? short-term signal instability. latch ? a circuit that retains the voltage level (logic 1 or logic 0) written to it for as long as power is applied to the circuit. latency ? the time lag between instruction completion and data movement. least significant bit (lsb) ? the rightmost digit of a binary number. logic 1 ? a voltage level approximately equal to the input power voltage (v dd ). logic 0 ? a voltage level approximately equal to the ground voltage (v ss ). low byte ? the least significant eight bits of a word. m68hc12 ? a motorola family of 16-bit mcus. mark/space ? the logic 1/logic 0 convention used in formatting data in serial communication. mask ? 1. a logic circuit that forces a bit or group of bits to a desired state. 2. a photomask used in integrated circuit fabrication to transfer an image onto silicon. mcu ? microcontroller unit. see ? microcontroller. ? memory location ? each m68hc12 memory location holds one byte of data and has a unique address. to store information in a memory location, the cpu places the address of the location on the address bus, the data information on the data bus, and asserts the write signal. to read information from a memory location, the cpu places the address of the location on the address bus and asserts the read signal. in response to the read signal, the selected memory location places its data onto the data bus. memory map ? a pictorial representation of all memory locations in a computer system.
glossary mc68hc912dt128a rev 1.0 motorola glossary 395 mi-bus ? see "motorola interconnect bus". microcontroller ? microcontroller unit (mcu). a complete computer system, including a cpu, memory, a clock oscillator, and input/output (i/o) on a single integrated circuit. modulo counter ? a counter that can be programmed to count to any number from zero to its maximum possible modulus. most significant bit (msb) ? the leftmost digit of a binary number. motorola interconnect bus (mi-bus) ? the motorola interconnect bus (mi bus) is a serial communications protocol which supports distributed real-time control efficiently and with a high degree of noise immunity. motorola scalable can (mscan) ? the motorola scalable controller area network is a serial communications protocol that efficiently supports distributed real-time control with a very high level of data integrity. mscan ? see "motorola scalable can". msi ? see "multiple serial interface". multiple serial interface ? a module consisting of multiple independent serial i/o sub-systems, e.g. two sci and one spi. multiplexer ? a device that can select one of a number of inputs and pass the logic level of that input on to the output. nibble ? a set of four bits (half of a byte). object code ? the output from an assembler or compiler that is itself executable machine code, or is suitable for processing to produce executable machine code. opcode ? a binary code that instructs the cpu to perform an operation. open-drain ? an output that has no pullup transistor. an external pullup device can be connected to the power supply to provide the logic 1 output voltage. operand ? data on which an operation is performed. usually a statement consists of an operator and an operand. for example, the operator may be an add instruction, and the operand may be the quantity to be added. oscillator ? a circuit that produces a constant frequency square wave that is used by the computer as a timing and sequencing reference.
glossary mc68hc912dt128a rev 1.0 396 glossary motorola otprom ? one-time programmable read-only memory. a nonvolatile type of memory that cannot be reprogrammed. overflow ? a quantity that is too large to be contained in one byte or one word. page zero ? the first 256 bytes of memory (addresses $0000 ? $00ff). parity ? an error-checking scheme that counts the number of logic 1s in each byte transmitted. in a system that uses odd parity, every byte is expected to have an odd number of logic 1s. in an even parity system, every byte should have an even number of logic 1s. in the transmitter, a parity generator appends an extra bit to each byte to make the number of logic 1s odd for odd parity or even for even parity. a parity checker in the receiver counts the number of logic 1s in each byte. the parity checker generates an error signal if it finds a byte with an incorrect number of logic 1s. pc ? see ? program counter (pc). ? peripheral ? a circuit not under direct cpu control. phase-locked loop (pll) ? a clock generator circuit in which a voltage controlled oscillator produces an oscillation which is synchronized to a reference signal. pll ? see "phase-locked loop (pll)." pointer ? pointer register. an index register is sometimes called a pointer register because its contents are used in the calculation of the address of an operand, and therefore points to the operand. polarity ? the two opposite logic levels, logic 1 and logic 0, which correspond to two different voltage levels, v dd and v ss . polling ? periodically reading a status bit to monitor the condition of a peripheral device. port ? a set of wires for communicating with off-chip devices. prescaler ? a circuit that generates an output signal related to the input signal by a fractional scale factor such as 1/2, 1/8, 1/10 etc.
glossary mc68hc912dt128a rev 1.0 motorola glossary 397 program ? a set of computer instructions that cause a computer to perform a desired operation or operations. program counter (pc) ? a 16-bit register in the cpu. the pc register holds the address of the next instruction or operand that the cpu will use. pull ? an instruction that copies into the accumulator the contents of a stack ram location. the stack ram address is in the stack pointer. pullup ? a transistor in the output of a logic gate that connects the output to the logic 1 voltage of the power supply. pulse-width ? the amount of time a signal is on as opposed to being in its off state. pulse-width modulation (pwm) ? controlled variation (modulation) of the pulse width of a signal with a constant frequency. push ? an instruction that copies the contents of the accumulator to the stack ram. the stack ram address is in the stack pointer. pwm period ? the time required for one complete cycle of a pwm waveform. ram ? random access memory. all ram locations can be read or written by the cpu. the contents of a ram memory location remain valid until the cpu writes a different value or until power is turned off. rc circuit ? a circuit consisting of capacitors and resistors having a defined time constant. read ? to copy the contents of a memory location to the accumulator. register ? a circuit that stores a group of bits. reserved memory location ? a memory location that is used only in special factory test modes. writing to a reserved location has no effect. reading a reserved location returns an unpredictable value. reset ? to force a device to a known condition. rom ? read-only memory. a type of memory that can be read but cannot be changed (written). the contents of rom must be specified before manufacturing the mcu.
glossary mc68hc912dt128a rev 1.0 398 glossary motorola sci ? see "serial communication interface module (sci)." serial ? pertaining to sequential transmission over a single line. serial communications interface module (sci) ? a module that supports asynchronous communication. serial peripheral interface module (spi) ? a module that supports synchronous communication. set ? to change a bit from logic 0 to logic 1; opposite of clear. shift register ? a chain of circuits that can retain the logic levels (logic 1 or logic 0) written to them and that can shift the logic levels to the right or left through adjacent circuits in the chain. signed ? a binary number notation that accommodates both positive and negative numbers. the most significant bit is used to indicate whether the number is positive or negative, normally logic 0 for positive and logic 1 for negative. the other seven bits indicate the magnitude of the number. software ? instructions and data that control the operation of a microcontroller. software interrupt (swi) ? an instruction that causes an interrupt and its associated vector fetch. spi ? see "serial peripheral interface module (spi)." stack ? a portion of ram reserved for storage of cpu register contents and subroutine return addresses. stack pointer (sp) ? a 16-bit register in the cpu containing the address of the next available storage location on the stack. start bit ? a bit that signals the beginning of an asynchronous serial transmission. status bit ? a register bit that indicates the condition of a device. stop bit ? a bit that signals the end of an asynchronous serial transmission.
glossary mc68hc912dt128a rev 1.0 motorola glossary 399 subroutine ? a sequence of instructions to be used more than once in the course of a program. the last instruction in a subroutine is a return from subroutine (rts) instruction. at each place in the main program where the subroutine instructions are needed, a jump or branch to subroutine (jsr or bsr) instruction is used to call the subroutine. the cpu leaves the flow of the main program to execute the instructions in the subroutine. when the rts instruction is executed, the cpu returns to the main program where it left off. synchronous ? refers to logic circuits and operations that are synchronized by a common reference signal. timer ? a module used to relate events in a system to a point in time. toggle ? to change the state of an output from a logic 0 to a logic 1 or from a logic 1 to a logic 0. tracking mode ? a mode of pll operation with narrow loop bandwidth. also see ? acquisition mode. ? two ? s complement ? a means of performing binary subtraction using addition techniques. the most significant bit of a two ? s complement number indicates the sign of the number (1 indicates negative). the two ? s complement negative of a number is obtained by inverting each bit in the number and then adding 1 to the result. unbuffered ? utilizes only one register for data; new data overwrites current data. unimplemented memory location ? a memory location that is not used. writing to an unimplemented location has no effect. reading an unimplemented location returns an unpredictable value. variable ? a value that changes during the course of program execution. vco ? see "voltage-controlled oscillator." vector ? a memory location that contains the address of the beginning of a subroutine written to service an interrupt or reset. voltage-controlled oscillator (vco) ? a circuit that produces an oscillating output signal of a frequency that is controlled by a dc voltage applied to a control input. waveform ? a graphical representation in which the amplitude of a wave is plotted against time. wired-or ? connection of circuit outputs so that if any output is high, the connection point is high. word ? a set of two bytes (16 bits). write ? the transfer of a byte of data from the cpu to a memory location.
glossary mc68hc912dt128a rev 1.0 400 glossary motorola
mc68hc912dt128a rev 2.0 motorola literature updates 401 literature updates literature updates this document contains the latest data available at publication time. for updates, contact one of the centers listed below: literature distribution centers order literature by mail or phone. usa/europe motorola literature distribution p.o. box 5405 denver, colorado, 80217 phone 1-303-675-2140 japan motorola japan ltd. tatsumi-spd-jldc toshikatsu otsuki 6f seibu-butsuryu center 3-14-2 tatsumi koto-ku tokyo 135, japan phone 03-3521-8315 hong kong motorola semiconductors h.k. ltd. 8b tai ping industrial park 51 ting kok road tai po, n.t., hong kong phone 852-26629298
literature updates mc68hc912dt128a rev 2.0 402 literature updates motorola customer focus center 1-800-521-6274 microcontroller division ? s web site directly access the microcontroller division ? s web site with the following url: http://mcu.motsps.com/
2 1 3 4 5 6 7 8 9 10 11 12 13 14 15
motorola reserves the right to make changes without further notice to any products herein. motorola makes no warranty, represen tation or guarantee regarding the suitability of its products for any particular purpose, nor does motorola assume any liability arising out of the application o r use of any product or circuit, and specifically disclaims any and all liability, including without limitation consequential or incidental damages. "typical" param eters which may be provided in motorola data sheets and/or specifications can and do vary in different applications and actual performance may vary over time. all oper ating parameters, including "typicals" must be validated for each customer application by customer ? s technical experts. motorola does not convey any license under its patent rights nor the rights of others. motorola products are not designed, intended, or authorized for use as components in systems intended for surgical impl ant into the body, or other applications intended to support or sustain life, or for any other application in which the failure of the motorola product cou ld create a situation where personal injury or death may occur. should buyer purchase or use motorola products for any such unintended or unauthorized application, buyer s hall indemnify and hold motorola and its officers, employees, subsidiaries, affiliates, and distributors harmless against all claims, costs, damages, and expens es, and reasonable attorney fees arising out of, directly or indirectly, any claim of personal injury or death associated with such unintended or unauthorized use, even if such claim alleges that motorola was negligent regarding the design or manufacture of the part. motorola and are registered trademarks of motorola, inc. motorola, in c. is an equal opportunity/affirmative action employer. how to reach us: usa/europe: motorola literature distribution; p.o. box 5405, denver, colorado 80217. 1-303-675-2140 japan: motorola japan ltd.; tatsumi-spd-jldc, 6f seibu-butsuryu-center, 3-14-2 tatsumi koto-ku, tokyo 135, japan. 81-3-3521-8315 hong kong: motorola semiconductors h.k. ltd.; 8b tai ping industrial park, 51 ting kok road, tai po, n.t., hong kong. 852-26629298 customer focus center: 1-800-521-6274 ? motorola, inc., 1999 mc68hc912dt128a/d


▲Up To Search▲   

 
Price & Availability of MC912DG128A

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X